aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/tests
diff options
context:
space:
mode:
authorRoland Tapken <roland@bitarbeiter.net>2018-02-06 16:44:04 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-02-15 18:51:12 +0100
commit38ba64af77f9c58f13b59d3470465fce1a7f1ff2 (patch)
tree90d49d8136f8b4a983c33dd42a75fc5174de6c2d /apps/files/tests
parentc688da7195755273f9b040dc9a16898686e6e68a (diff)
downloadnextcloud-server-38ba64af77f9c58f13b59d3470465fce1a7f1ff2.tar.gz
nextcloud-server-38ba64af77f9c58f13b59d3470465fce1a7f1ff2.zip
Split move and copy operations
The new 'Move and copy' operation from #6040 requires UPDATE permissions on the selected files. However, READ would be sufficient to create a copy of a file (if not viewed as a public share). For this reason this patch: - changes the permission of the 'MoveCopy' action to PERMISSION_READ - changes the label of the action depending on the permissions - changes the available buttons in the Move/Copy dialog depending on the permissions. The same changes are done to the filelist view for bulk actions. Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/js/fileactionsmenuSpec.js3
-rw-r--r--apps/files/tests/js/filelistSpec.js9
2 files changed, 11 insertions, 1 deletions
diff --git a/apps/files/tests/js/fileactionsmenuSpec.js b/apps/files/tests/js/fileactionsmenuSpec.js
index 926516b3043..c678d166153 100644
--- a/apps/files/tests/js/fileactionsmenuSpec.js
+++ b/apps/files/tests/js/fileactionsmenuSpec.js
@@ -271,6 +271,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
$file: $tr,
fileList: fileList,
fileActions: fileActions,
+ fileInfoModel: new OCA.Files.FileInfoModel(fileData),
dir: fileList.getCurrentDirectory()
};
menu = new OCA.Files.FileActionsMenu();
@@ -304,6 +305,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
$file: $tr,
fileList: fileList,
fileActions: fileActions,
+ fileInfoModel: new OCA.Files.FileInfoModel(fileData),
dir: '/anotherpath/there'
};
menu = new OCA.Files.FileActionsMenu();
@@ -336,6 +338,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
$file: $tr,
fileList: fileList,
fileActions: fileActions,
+ fileInfoModel: new OCA.Files.FileInfoModel(fileData),
dir: '/somepath/dir'
};
menu = new OCA.Files.FileActionsMenu();
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 08da15b8a88..1b26a468172 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -94,7 +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="copy-move"><span class="label">Move or copy</span></a>' +
'<a href class="download"><img src="actions/download.svg">Download</a>' +
'<a href class="delete-selected">Delete</a></span>' +
'</th>' +
@@ -2101,10 +2101,17 @@ describe('OCA.Files.FileList tests', function() {
$('#permissions').val(OC.PERMISSION_READ | OC.PERMISSION_UPDATE);
$('.select-all').click();
expect(fileList.$el.find('.selectedActions .copy-move').hasClass('hidden')).toEqual(false);
+ expect(fileList.$el.find('.selectedActions .copy-move .label').text()).toEqual('Move or copy');
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(false);
+ expect(fileList.$el.find('.selectedActions .copy-move .label').text()).toEqual('Copy');
+ testFiles[0].permissions = OC.PERMISSION_NONE;
+ $('.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 () {