mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-12311] Remove manage versions dialog box for non versionable file (#5307)
* [ACS-12311] Remove manage versions dialog box for non versionable file * [ACS-12311] Add few more unit test for empty entry and aspectnames * [ACS-12311] Fix manage versions for search-results * Added e2e fix and exclude test * Added e2e no test fix and exclude test --------- Co-authored-by: akashrathod28 <akash.rathod@hyland.com>
This commit is contained in:
co-authored by
akashrathod28
parent
7fe08ff1a8
commit
1d7686729e
@@ -250,6 +250,38 @@ describe('app.evaluators', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isVersionableFile', () => {
|
||||
it('should return true when the selected file has the cm:versionable aspect', () => {
|
||||
context.selection.file = { entry: { aspectNames: ['cm:versionable'] } } as NodeEntry;
|
||||
|
||||
expect(app.isVersionableFile(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when the selected file lacks the cm:versionable aspect', () => {
|
||||
context.selection.file = { entry: { aspectNames: ['cm:auditable'] } } as NodeEntry;
|
||||
|
||||
expect(app.isVersionableFile(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false when the selected file has no entry', () => {
|
||||
context.selection.file = {} as NodeEntry;
|
||||
|
||||
expect(app.isVersionableFile(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false when the selected file has no aspectNames', () => {
|
||||
context.selection.file = { entry: {} } as NodeEntry;
|
||||
|
||||
expect(app.isVersionableFile(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false when there is no file selected', () => {
|
||||
context.selection.file = undefined;
|
||||
|
||||
expect(app.isVersionableFile(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isShared', () => {
|
||||
it('should return true if route is shared files and single selection', () => {
|
||||
context.navigation.url = '/shared';
|
||||
|
||||
@@ -529,6 +529,20 @@ export function createVersionRule(minimalVersion: string): (context: RuleContext
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the selected file has the `cm:versionable` aspect.
|
||||
* JSON ref: `app.selection.file.isVersionable`
|
||||
*
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export const isVersionableFile = (context: RuleContext): boolean => {
|
||||
const file = context?.selection?.file;
|
||||
if (!file?.entry) {
|
||||
return false;
|
||||
}
|
||||
return (file.entry.aspectNames ?? []).includes('cm:versionable');
|
||||
};
|
||||
|
||||
function isVersionCompatible(currentVersion: string, minimalVersion: string): boolean {
|
||||
if (!currentVersion || !minimalVersion) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user