diff options
author | Abijeet <abijeetpatro@gmail.com> | 2018-06-06 23:30:56 +0530 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-18 07:39:44 +0200 |
commit | e89f6590e2983c55b1a15f700eb3258554f36197 (patch) | |
tree | bcc65a94e8271062a07bdf9159b3f66447a9562b /apps/files_trashbin/tests/js | |
parent | 0ca9ce0f84a00bf2cabb84be52a3cdaeb7e08cd8 (diff) | |
download | nextcloud-server-e89f6590e2983c55b1a15f700eb3258554f36197.tar.gz nextcloud-server-e89f6590e2983c55b1a15f700eb3258554f36197.zip |
Fixed failing test cases for the new actions menu.
Signed-off-by: Abijeet <abijeetpatro@gmail.com>
Diffstat (limited to 'apps/files_trashbin/tests/js')
-rw-r--r-- | apps/files_trashbin/tests/js/filelistSpec.js | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/apps/files_trashbin/tests/js/filelistSpec.js b/apps/files_trashbin/tests/js/filelistSpec.js index 04ff243d07b..9d1308af3e4 100644 --- a/apps/files_trashbin/tests/js/filelistSpec.js +++ b/apps/files_trashbin/tests/js/filelistSpec.js @@ -46,8 +46,8 @@ describe('OCA.Trashbin.FileList tests', function() { '<input type="checkbox" id="select_all_trash" class="select-all">' + '<span class="name">Name</span>' + '<span class="selectedActions hidden">' + - '<a href class="undelete">Restore</a>' + - '<a href class="delete-selected">Delete</a></span>' + + '<a href="" class="actions-selected"><span class="icon icon-more"></span><span>Actions</span>' + + '</span>' + '</th></tr></thead>' + '<tbody id="fileList"></tbody>' + '<tfoot></tfoot>' + @@ -90,7 +90,18 @@ describe('OCA.Trashbin.FileList tests', function() { var fileActions = OCA.Trashbin.App._createFileActions(fileList); fileList = new OCA.Trashbin.FileList( $('#app-content-trashbin'), { - fileActions: fileActions + fileActions: fileActions, + multiSelectMenu: [{ + name: 'restore', + displayName: t('files', 'Restore'), + iconClass: 'icon-history', + }, + { + name: 'delete', + displayName: t('files', 'Delete'), + iconClass: 'icon-delete', + } + ] } ); }); @@ -260,33 +271,39 @@ describe('OCA.Trashbin.FileList tests', function() { fileList.findFileEl('One.txt.d11111').find('input:checkbox').click(); fileList.findFileEl('Three.pdf.d33333').find('input:checkbox').click(); fileList.findFileEl('somedir.d99999').find('input:checkbox').click(); + fileList.$el.find('.actions-selected').click(); + }); + + afterEach(function() { + fileList.$el.find('.actions-selected').click(); }); + describe('Delete', function() { it('Shows trashbin actions', function() { // visible because a few files were selected expect($('.selectedActions').is(':visible')).toEqual(true); - expect($('.selectedActions .delete-selected').is(':visible')).toEqual(true); - expect($('.selectedActions .undelete').is(':visible')).toEqual(true); + expect($('.selectedActions .item-delete').is(':visible')).toEqual(true); + expect($('.selectedActions .item-restore').is(':visible')).toEqual(true); // check fileList.$el.find('.select-all').click(); // stays visible expect($('.selectedActions').is(':visible')).toEqual(true); - expect($('.selectedActions .delete-selected').is(':visible')).toEqual(true); - expect($('.selectedActions .undelete').is(':visible')).toEqual(true); + expect($('.selectedActions .item-delete').is(':visible')).toEqual(true); + expect($('.selectedActions .item-restore').is(':visible')).toEqual(true); // uncheck fileList.$el.find('.select-all').click(); // becomes hidden now expect($('.selectedActions').is(':visible')).toEqual(false); - expect($('.selectedActions .delete-selected').is(':visible')).toEqual(false); - expect($('.selectedActions .undelete').is(':visible')).toEqual(false); + expect($('.selectedActions .item-delete').is(':visible')).toEqual(false); + expect($('.selectedActions .item-restore').is(':visible')).toEqual(false); }); it('Deletes selected files when "Delete" clicked', function() { var request; - $('.selectedActions .delete-selected').click(); + $('.selectedActions .filesSelectMenu .delete').click(); expect(fakeServer.requests.length).toEqual(1); request = fakeServer.requests[0]; expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/delete.php'); @@ -314,7 +331,7 @@ describe('OCA.Trashbin.FileList tests', function() { it('Deletes all files when all selected when "Delete" clicked', function() { var request; $('.select-all').click(); - $('.selectedActions .delete-selected').click(); + $('.selectedActions .filesSelectMenu .delete').click(); expect(fakeServer.requests.length).toEqual(1); request = fakeServer.requests[0]; expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/delete.php'); @@ -331,7 +348,7 @@ describe('OCA.Trashbin.FileList tests', function() { describe('Restore', function() { it('Restores selected files when "Restore" clicked', function() { var request; - $('.selectedActions .undelete').click(); + $('.selectedActions .filesSelectMenu .restore').click(); expect(fakeServer.requests.length).toEqual(1); request = fakeServer.requests[0]; expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/undelete.php'); @@ -359,7 +376,7 @@ describe('OCA.Trashbin.FileList tests', function() { it('Restores all files when all selected when "Restore" clicked', function() { var request; $('.select-all').click(); - $('.selectedActions .undelete').click(); + $('.selectedActions .filesSelectMenu .restore').click(); expect(fakeServer.requests.length).toEqual(1); request = fakeServer.requests[0]; expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/undelete.php'); |