[ACA-2221] Lock node - check selection is not null (#966)

* check selection is not null

* test
This commit is contained in:
Cilibiu Bogdan 2019-02-22 09:02:44 +02:00 committed by Adina Parpalita
parent 52a4740463
commit 4ed77d45bb
2 changed files with 7 additions and 1 deletions

View File

@ -69,6 +69,12 @@ describe('LockNodeDirective', () => {
api = TestBed.get(AlfrescoApiService);
});
it('should return false if selection is null', () => {
component.selection = null;
fixture.detectChanges();
expect(component.directive.isNodeLocked()).toBe(false);
});
it('should return false if selection is not locked', () => {
component.selection = { entry: { name: 'test-name', properties: {} } };
fixture.detectChanges();

View File

@ -54,7 +54,7 @@ export class LockNodeDirective {
constructor(private alfrescoApiService: AlfrescoApiService) {}
isNodeLocked(): boolean {
return isLocked(this.node);
return !!(this.node && isLocked(this.node));
}
private async toggleLock(node: NodeEntry | SharedLinkEntry) {