summaryrefslogtreecommitdiffstats
path: root/apps/files/tests/js/filelistSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/tests/js/filelistSpec.js')
-rw-r--r--apps/files/tests/js/filelistSpec.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index c1c8e4ce337..59e3f8a9d4e 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1790,6 +1790,36 @@ describe('OCA.Files.FileList tests', function() {
expect(fileList.$el.find('.select-all').prop('checked')).toEqual(false);
expect(fileList.getSelectedFiles()).toEqual([]);
});
+ describe('Disabled selection', function() {
+ beforeEach(function() {
+ fileList._allowSelection = false;
+ fileList.setFiles(testFiles);
+ });
+ it('Does not render checkboxes', function() {
+ expect(fileList.$fileList.find('.selectCheckBox').length).toEqual(0);
+ });
+ it('Does not select a file with Ctrl or Shift if selection is not allowed', function() {
+ var $tr = fileList.findFileEl('One.txt');
+ var $tr2 = fileList.findFileEl('Three.pdf');
+ var e;
+ e = new $.Event('click');
+ e.ctrlKey = true;
+ $tr.find('td.filename .name').trigger(e);
+
+ // click on second entry, does not clear the selection
+ e = new $.Event('click');
+ e.ctrlKey = true;
+ $tr2.find('td.filename .name').trigger(e);
+
+ expect(fileList.getSelectedFiles().length).toEqual(0);
+
+ // deselect now
+ e = new $.Event('click');
+ e.shiftKey = true;
+ $tr2.find('td.filename .name').trigger(e);
+ expect(fileList.getSelectedFiles().length).toEqual(0);
+ });
+ })
});
describe('File actions', function() {
it('Clicking on a file name will trigger default action', function() {