@@ -213,4 +213,51 @@ describe('Files: Actions', { testIsolation: true }, () => {
213
213
getSelectionActionEntry ( 'nested-child-1' ) . should ( 'not.exist' )
214
214
getSelectionActionEntry ( 'nested-child-2' ) . should ( 'not.exist' )
215
215
} )
216
+
217
+ it ( 'Do not show parent if nested action has no batch support' , ( ) => {
218
+ const parent = new FileAction ( {
219
+ id : 'nested-action' ,
220
+ displayName : ( ) => 'Nested Action' ,
221
+ exec : cy . spy ( ) ,
222
+ iconSvgInline : ( ) => '<svg></svg>' ,
223
+ } )
224
+
225
+ const child1 = new FileAction ( {
226
+ id : 'nested-child-1' ,
227
+ displayName : ( ) => 'Nested Child 1' ,
228
+ exec : cy . spy ( ) ,
229
+ iconSvgInline : ( ) => '<svg></svg>' ,
230
+ parent : 'nested-action' ,
231
+ } )
232
+
233
+ const child2 = new FileAction ( {
234
+ id : 'nested-child-2' ,
235
+ displayName : ( ) => 'Nested Child 2' ,
236
+ exec : cy . spy ( ) ,
237
+ iconSvgInline : ( ) => '<svg></svg>' ,
238
+ parent : 'nested-action' ,
239
+ } )
240
+
241
+ cy . visit ( '/apps/files' , {
242
+ // Cannot use registerFileAction here
243
+ onBeforeLoad : ( win ) => {
244
+ if ( ! win . _nc_fileactions ) win . _nc_fileactions = [ ]
245
+ // Cannot use registerFileAction here
246
+ win . _nc_fileactions . push ( parent )
247
+ win . _nc_fileactions . push ( child1 )
248
+ win . _nc_fileactions . push ( child2 )
249
+ } ,
250
+ } )
251
+
252
+ selectRowForFile ( 'image.jpg' )
253
+
254
+ // Open the menu
255
+ getSelectionActionButton ( ) . click ( { force : true } )
256
+
257
+ // Check we have the parent action but not the children
258
+ getSelectionActionEntry ( 'nested-action' ) . should ( 'not.exist' )
259
+ getSelectionActionEntry ( 'menu-back' ) . should ( 'not.exist' )
260
+ getSelectionActionEntry ( 'nested-child-1' ) . should ( 'not.exist' )
261
+ getSelectionActionEntry ( 'nested-child-2' ) . should ( 'not.exist' )
262
+ } )
216
263
} )
0 commit comments