diff --git a/src/app/directives/lock-node.directive.spec.ts b/src/app/directives/lock-node.directive.spec.ts index 0d497588b..ff444523e 100644 --- a/src/app/directives/lock-node.directive.spec.ts +++ b/src/app/directives/lock-node.directive.spec.ts @@ -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(); diff --git a/src/app/directives/lock-node.directive.ts b/src/app/directives/lock-node.directive.ts index 3bb5e818d..6f328077b 100644 --- a/src/app/directives/lock-node.directive.ts +++ b/src/app/directives/lock-node.directive.ts @@ -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) {