File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 13571357 * @return {Object } jQuery object of the matching row
13581358 */
13591359 findFileEl : function ( fileName ) {
1360- // use filterAttr to avoid escaping issues
1361- return this . $fileList . find ( 'tr' ) . filterAttr ( 'data-file' , fileName ) ;
1360+ var fileRow = this . $fileList . find ( 'tr' ) . filterAttr ( 'data-file' , fileName ) ;
1361+ if ( fileRow . length ) {
1362+ return fileRow ;
1363+ }
1364+
1365+ // The row we try to get might not have been rendered due to pagination,
1366+ // so in case we find the file in the file list return the rendered row instead
1367+ var fileData = this . files . find ( function ( el ) {
1368+ return el . name === fileName ;
1369+ } ) ;
1370+
1371+ return fileData ? this . _renderRow ( fileData , { updateSummary : false , silent : true } ) : fileRow ;
13621372 } ,
13631373
13641374 /**
Original file line number Diff line number Diff line change @@ -825,7 +825,7 @@ describe('OCA.Files.FileList tests', function() {
825825 // element is renamed before the request finishes
826826 $tr = fileList . findFileEl ( 'Tu_after_three.txt' ) ;
827827 expect ( $tr . length ) . toEqual ( 1 ) ;
828- expect ( fileList . findFileEl ( ' One.txt') . length ) . toEqual ( 0 ) ;
828+ expect ( $ ( '.files- fileList tr' ) . find ( '[data-name=" One.txt"] ') . length ) . toEqual ( 0 ) ;
829829 // file actions are hidden
830830 expect ( $tr . hasClass ( 'busy' ) ) . toEqual ( true ) ;
831831
@@ -1426,7 +1426,7 @@ describe('OCA.Files.FileList tests', function() {
14261426 name : 'File with index 28b.txt'
14271427 } ) ;
14281428 expect ( $ ( '.files-fileList tr' ) . length ) . toEqual ( 20 ) ;
1429- expect ( fileList . findFileEl ( ' File with index 28b.txt') . length ) . toEqual ( 0 ) ;
1429+ expect ( $ ( '.files- fileList tr' ) . find ( '[data-name=" File with index 28b.txt"] ') . length ) . toEqual ( 0 ) ;
14301430 fileList . _nextPage ( true ) ;
14311431 expect ( $ ( '.files-fileList tr' ) . length ) . toEqual ( 40 ) ;
14321432 expect ( fileList . findFileEl ( 'File with index 28b.txt' ) . index ( ) ) . toEqual ( 29 ) ;
You can’t perform that action at this time.
0 commit comments