@@ -2489,6 +2489,30 @@ describe('OCA.Files.FileList tests', function() {
24892489 expect ( context . fileActions ) . toBeDefined ( ) ;
24902490 expect ( context . dir ) . toEqual ( '/subdir' ) ;
24912491 } ) ;
2492+ it ( 'Clicking on an empty space of the file row will trigger the "Details" action' , function ( ) {
2493+ var detailsActionStub = sinon . stub ( ) ;
2494+ fileList . setFiles ( testFiles ) ;
2495+ // Override the "Details" action set internally by the FileList for
2496+ // easier testing.
2497+ fileList . fileActions . registerAction ( {
2498+ mime : 'all' ,
2499+ name : 'Details' ,
2500+ permissions : OC . PERMISSION_NONE ,
2501+ actionHandler : detailsActionStub
2502+ } ) ;
2503+ // Ensure that the action works even if fileActions.currentFile is
2504+ // not set.
2505+ fileList . fileActions . currentFile = null ;
2506+ var $tr = fileList . findFileEl ( 'One.txt' ) ;
2507+ $tr . find ( 'td.filename a.name' ) . click ( ) ;
2508+ expect ( detailsActionStub . calledOnce ) . toEqual ( true ) ;
2509+ expect ( detailsActionStub . getCall ( 0 ) . args [ 0 ] ) . toEqual ( 'One.txt' ) ;
2510+ var context = detailsActionStub . getCall ( 0 ) . args [ 1 ] ;
2511+ expect ( context . $file . is ( $tr ) ) . toEqual ( true ) ;
2512+ expect ( context . fileList ) . toBe ( fileList ) ;
2513+ expect ( context . fileActions ) . toBe ( fileList . fileActions ) ;
2514+ expect ( context . dir ) . toEqual ( '/subdir' ) ;
2515+ } ) ;
24922516 it ( 'redisplays actions when new actions have been registered' , function ( ) {
24932517 var actionStub = sinon . stub ( ) ;
24942518 var readyHandler = sinon . stub ( ) ;
0 commit comments