mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-2645] Shared - don't render shared settings action for multiple selection (#1141)
* check if is single selection * tests
This commit is contained in:
committed by
Denys Vuika
parent
9176cf993c
commit
16b7eee621
@@ -362,4 +362,81 @@ describe('app.evaluators', () => {
|
||||
expect(app.canUploadVersion(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isShared', () => {
|
||||
it('should return true if route is shared files and single selection', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {}
|
||||
},
|
||||
navigation: {
|
||||
url: '/shared'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isShared(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if route is shared files and multiple selection', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: null
|
||||
},
|
||||
navigation: {
|
||||
url: '/shared'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isShared(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if route is trashcan route', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {}
|
||||
},
|
||||
navigation: {
|
||||
url: '/trashcan'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isShared(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if selection is not shared', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {
|
||||
entry: {
|
||||
properties: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
navigation: {
|
||||
url: '/other'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isShared(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true if selection is shared', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {
|
||||
entry: {
|
||||
properties: {
|
||||
'qshare:sharedId': 'some-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
navigation: {
|
||||
url: '/other'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isShared(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -114,7 +114,7 @@ export function canEditFolder(context: RuleContext): boolean {
|
||||
* JSON ref: `app.selection.file.isShared`
|
||||
*/
|
||||
export function isShared(context: RuleContext): boolean {
|
||||
if (navigation.isSharedFiles(context) && !context.selection.isEmpty) {
|
||||
if (navigation.isSharedFiles(context) && context.selection.file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user