edit node permission (#261)

This commit is contained in:
Cilibiu Bogdan
2018-03-27 11:49:49 +03:00
committed by suzanadirla
parent 56ddeb8c40
commit ded29aee4d
6 changed files with 64 additions and 0 deletions

View File

@@ -346,4 +346,40 @@ describe('PageComponent', () => {
expect(component.canMoveShared(selection)).toBe(false);
});
});
describe('canUpdate()', () => {
it('should return true if node can be edited', () => {
const selection = [ { entry: {
allowableOperations: ['update']
} } ];
expect(component.canUpdate(selection)).toBe(true);
});
it(`should return false if node cannot be edited`, () => {
const selection = [ { entry: {
allowableOperations: ['other-permission']
} } ];
expect(component.canUpdate(selection)).toBe(false);
});
});
describe('canUpdateShared()', () => {
it('should return true if shared node can be edited', () => {
const selection = [ { entry: {
allowableOperationsOnTarget: ['update']
} } ];
expect(component.canUpdateShared(selection)).toBe(true);
});
it(`should return false if shared node cannot be edited`, () => {
const selection = [ { entry: {
allowableOperationsOnTarget: ['other-permission']
} } ];
expect(component.canUpdateShared(selection)).toBe(false);
});
});
});