Skip to content
Snippets Groups Projects
Commit 7154efb9 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6311 clear collaboration request result (workaround until loading is implemented)

parent 106ba4ec
Branches
Tags
No related merge requests found
......@@ -99,4 +99,12 @@ describe('OrganisationsEinheitService', () => {
expect(searchService.selectResult).toHaveBeenCalledWith(organisationsEinheitResource);
});
});
describe('clear selected result', () => {
it('should call service', () => {
service.clearSelectedResult();
expect(searchService.clearSelectedResult).toHaveBeenCalled();
});
});
});
......@@ -30,4 +30,8 @@ export class OrganisationsEinheitService {
public selectSearchResult(organisationsEinheitResource: OrganisationsEinheitResource): void {
this.searchService.selectResult(organisationsEinheitResource);
}
public clearSelectedResult(): void {
this.searchService.clearSelectedResult();
}
}
......@@ -155,4 +155,12 @@ describe('CollaborationInVorgangContainerComponent', () => {
expect(service.hideRequestForm).toHaveBeenCalled();
});
});
describe('ngOnDestroy', () => {
it('should call service to clear selected result', () => {
component.ngOnDestroy();
expect(organisationsEinheitSearchService.clearSelectedResult).toHaveBeenCalled();
});
});
});
import { OrganisationsEinheitResource } from '@alfa-client/collaboration-shared';
import { StateResource } from '@alfa-client/tech-shared';
import { Component, OnInit } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { CollaborationListResource } from 'libs/collaboration-shared/src/lib/collaboration.model';
import { CollaborationService } from 'libs/collaboration-shared/src/lib/collaboration.service';
import { OrganisationsEinheitResourceSearchService } from 'libs/collaboration-shared/src/lib/organisations-einheit-resource-search.service';
......@@ -10,7 +10,7 @@ import { Observable } from 'rxjs';
selector: 'alfa-collaboration-in-vorgang-container',
templateUrl: './collaboration-in-vorgang-container.component.html',
})
export class CollaborationInVorgangContainerComponent implements OnInit {
export class CollaborationInVorgangContainerComponent implements OnInit, OnDestroy {
public collaborationStateListResource$: Observable<StateResource<CollaborationListResource>>;
public isRequestFormVisible$: Observable<boolean>;
public selectedOrganisationsEinheit$: Observable<OrganisationsEinheitResource>;
......@@ -33,4 +33,8 @@ export class CollaborationInVorgangContainerComponent implements OnInit {
public hideRequestForm(): void {
this.service.hideRequestForm();
}
ngOnDestroy(): void {
this.searchService.clearSelectedResult();
}
}
......@@ -191,4 +191,16 @@ describe('ResourceSearchService', () => {
expect(service.selectedResource.value).toEqual(dummyResource);
});
});
describe('clear select result', () => {
const dummyResource: Resource = createDummyResource();
it('should update selected resource to null', () => {
service.selectedResource.next(dummyResource);
service.clearSelectedResult();
expect(service.selectedResource.value).toBeNull();
});
});
});
......@@ -98,4 +98,8 @@ export class ResourceSearchService<
public selectResult(selected: I): void {
this.selectedResource.next(selected);
}
public clearSelectedResult(): void {
this.selectedResource.next(null);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment