diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-11-02 12:47:57 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-11-02 12:47:57 +0100 |
commit | a9540fe99044fd26f5c876438ae83697dbd1fe8e (patch) | |
tree | c94493651d61b54e0477b304e9ae9885fae1ac28 /apps/files/tests | |
parent | 8ee765a61743db31749b0bdb51ce09915458325f (diff) | |
download | nextcloud-server-a9540fe99044fd26f5c876438ae83697dbd1fe8e.tar.gz nextcloud-server-a9540fe99044fd26f5c876438ae83697dbd1fe8e.zip |
Hide summary file actions when a selected file does not match
When several files are selected and one of them can not be deleted the
"Delete" file action is not shown in the summary. This commit extends
that behaviour too to the other file actions in the summary ("Move or
copy" and "Download"), so now an action is shown in the summary only if
it can be executed on all the currently selected files.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 8bb188e3602..fd011474eb1 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -94,6 +94,7 @@ describe('OCA.Files.FileList tests', function() { '<input type="checkbox" id="select_all_files" class="select-all checkbox">' + '<a class="name columntitle" data-sort="name"><span>Name</span><span class="sort-indicator"></span></a>' + '<span id="selectedActionsList" class="selectedActions hidden">' + + '<a href class="copy-move">Move or copy</a>' + '<a href class="download"><img src="actions/download.svg">Download</a>' + '<a href class="delete-selected">Delete</a></span>' + '</th>' + @@ -2024,6 +2025,28 @@ describe('OCA.Files.FileList tests', function() { }); }); describe('Selection overlay', function() { + it('show doesnt show the copy/move action if one or more files are not copiable/movable', function () { + fileList.setFiles(testFiles); + $('#permissions').val(OC.PERMISSION_READ | OC.PERMISSION_UPDATE); + $('.select-all').click(); + expect(fileList.$el.find('.selectedActions .copy-move').hasClass('hidden')).toEqual(false); + testFiles[0].permissions = OC.PERMISSION_READ; + $('.select-all').click(); + fileList.setFiles(testFiles); + $('.select-all').click(); + expect(fileList.$el.find('.selectedActions .copy-move').hasClass('hidden')).toEqual(true); + }); + it('show doesnt show the download action if one or more files are not downloadable', function () { + fileList.setFiles(testFiles); + $('#permissions').val(OC.PERMISSION_READ | OC.PERMISSION_UPDATE); + $('.select-all').click(); + expect(fileList.$el.find('.selectedActions .download').hasClass('hidden')).toEqual(false); + testFiles[0].permissions = OC.PERMISSION_UPDATE; + $('.select-all').click(); + fileList.setFiles(testFiles); + $('.select-all').click(); + expect(fileList.$el.find('.selectedActions .download').hasClass('hidden')).toEqual(true); + }); it('show doesnt show the delete action if one or more files are not deletable', function () { fileList.setFiles(testFiles); $('#permissions').val(OC.PERMISSION_READ | OC.PERMISSION_DELETE); |