mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-2345] Metadata - edit button is not displayed for folders (#1078)
* remove node type check * tests
This commit is contained in:
committed by
Adina Parpalita
parent
380a5f0cb0
commit
b2b234c3cb
@@ -24,9 +24,67 @@
|
||||
*/
|
||||
|
||||
import { MetadataTabComponent } from './metadata-tab.component';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
describe('MetadataTabComponent', () => {
|
||||
it('should be defined', () => {
|
||||
expect(MetadataTabComponent).toBeDefined();
|
||||
let nodePermissionService: NodePermissionService;
|
||||
let component: MetadataTabComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
nodePermissionService = new NodePermissionService();
|
||||
const appConfig = <any>{ config: { 'content-metadata': {} } };
|
||||
const extension = <any>{ contentMetadata: {} };
|
||||
|
||||
component = new MetadataTabComponent(
|
||||
nodePermissionService,
|
||||
extension,
|
||||
appConfig
|
||||
);
|
||||
});
|
||||
|
||||
describe('canUpdateNode()', () => {
|
||||
it('should return true if node is not locked and has update permission', () => {
|
||||
const node = <Node>{
|
||||
isLocked: false,
|
||||
allowableOperations: ['update']
|
||||
};
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if node is locked', () => {
|
||||
const node = <Node>{
|
||||
isLocked: true,
|
||||
allowableOperations: ['update']
|
||||
};
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if node has no update permission', () => {
|
||||
const node = <Node>{
|
||||
isLocked: false,
|
||||
allowableOperations: ['other']
|
||||
};
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if node has read only property', () => {
|
||||
const node = <Node>{
|
||||
isLocked: false,
|
||||
allowableOperations: ['update'],
|
||||
properties: {
|
||||
'cm:lockType': 'WRITE_LOCK'
|
||||
}
|
||||
};
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -65,7 +65,7 @@ export class MetadataTabComponent {
|
||||
}
|
||||
|
||||
get canUpdateNode(): boolean {
|
||||
if (this.node && this.node.isFile && !isLocked({ entry: this.node })) {
|
||||
if (this.node && !isLocked({ entry: this.node })) {
|
||||
return this.permission.check(this.node, ['update']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user