[AAE-1950] and [AAE-1882] more unit test (#5521)

* [AAE-1882] Custom action unit test

* [AAE-1950] Filter E2E Community Unit test
This commit is contained in:
dhrn
2020-02-28 16:24:31 +05:30
committed by GitHub
parent 9d8479c259
commit b5d443f2a8
2 changed files with 85 additions and 32 deletions

View File

@@ -384,7 +384,7 @@ describe('DocumentList', () => {
new ContentActionModel({
target: 'document',
title: 'Action1',
disabled: (): boolean => true
disabled: (node): boolean => node.entry.name === 'custom'
}),
new ContentActionModel({
target: 'document',
@@ -393,12 +393,17 @@ describe('DocumentList', () => {
})
];
const nodeFile = { entry: { isFile: true, name: 'xyz' } };
const actions = documentList.getNodeActions(nodeFile);
let actions = documentList.getNodeActions({ entry: { id: 1, isFile: true, name: 'xyz' } });
expect(actions.length).toBe(2);
expect(actions[0].disabled).toBeTruthy();
expect(actions[1].disabled).toBeFalsy();
expect(actions[0].disabled).toBe(false);
expect(actions[1].disabled).toBe(false);
actions = documentList.getNodeActions({ entry: { id: 2, isFile: true, name: 'custom' } });
expect(actions.length).toBe(2);
expect(actions[0].disabled).toBe(true);
expect(actions[1].disabled).toBe(false);
});
it('should not disable the action if there is copy permission', () => {