|
|
|
@ -213,4 +213,51 @@ describe('Files: Actions', { testIsolation: true }, () => { |
|
|
|
|
getSelectionActionEntry('nested-child-1').should('not.exist') |
|
|
|
|
getSelectionActionEntry('nested-child-2').should('not.exist') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Do not show parent if nested action has no batch support', () => { |
|
|
|
|
const parent = new FileAction({ |
|
|
|
|
id: 'nested-action', |
|
|
|
|
displayName: () => 'Nested Action', |
|
|
|
|
exec: cy.spy(), |
|
|
|
|
iconSvgInline: () => '<svg></svg>', |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const child1 = new FileAction({ |
|
|
|
|
id: 'nested-child-1', |
|
|
|
|
displayName: () => 'Nested Child 1', |
|
|
|
|
exec: cy.spy(), |
|
|
|
|
iconSvgInline: () => '<svg></svg>', |
|
|
|
|
parent: 'nested-action', |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const child2 = new FileAction({ |
|
|
|
|
id: 'nested-child-2', |
|
|
|
|
displayName: () => 'Nested Child 2', |
|
|
|
|
exec: cy.spy(), |
|
|
|
|
iconSvgInline: () => '<svg></svg>', |
|
|
|
|
parent: 'nested-action', |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
cy.visit('/apps/files', { |
|
|
|
|
// Cannot use registerFileAction here
|
|
|
|
|
onBeforeLoad: (win) => { |
|
|
|
|
if (!win._nc_fileactions) win._nc_fileactions = [] |
|
|
|
|
// Cannot use registerFileAction here
|
|
|
|
|
win._nc_fileactions.push(parent) |
|
|
|
|
win._nc_fileactions.push(child1) |
|
|
|
|
win._nc_fileactions.push(child2) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
selectRowForFile('image.jpg') |
|
|
|
|
|
|
|
|
|
// Open the menu
|
|
|
|
|
getSelectionActionButton().click({ force: true }) |
|
|
|
|
|
|
|
|
|
// Check we have the parent action but not the children
|
|
|
|
|
getSelectionActionEntry('nested-action').should('not.exist') |
|
|
|
|
getSelectionActionEntry('menu-back').should('not.exist') |
|
|
|
|
getSelectionActionEntry('nested-child-1').should('not.exist') |
|
|
|
|
getSelectionActionEntry('nested-child-2').should('not.exist') |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|