diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-04-23 14:33:19 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-04-23 21:49:59 +0200 |
commit | f4bc852db3376f5e602c1970fe76b8698e26f32e (patch) | |
tree | 1a8f4e3c8c7717752548b8f66f032bac325a6023 /apps/files/tests | |
parent | f8f354b351a349898bbb5cdf2d9bee1c798c0f73 (diff) | |
download | nextcloud-server-f4bc852db3376f5e602c1970fe76b8698e26f32e.tar.gz nextcloud-server-f4bc852db3376f5e602c1970fe76b8698e26f32e.zip |
Show hint if there is no delete permission
* add class .no-permission which shows the default delete icon
* fixes #15172
* add unit test for no permission and for delete permission
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/fileactionsSpec.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js index 828aec9b6b9..53fa8707674 100644 --- a/apps/files/tests/js/fileactionsSpec.js +++ b/apps/files/tests/js/fileactionsSpec.js @@ -157,6 +157,48 @@ describe('OCA.Files.FileActions tests', function() { expect(deleteStub.getCall(0).args[1]).toEqual('/somepath/dir'); deleteStub.restore(); }); + it('shows delete hint when no permission to delete', function() { + var deleteStub = sinon.stub(fileList, 'do_delete'); + var fileData = { + id: 18, + type: 'file', + name: 'testName.txt', + path: '/somepath/dir', + mimetype: 'text/plain', + size: '1234', + etag: 'a01234c', + mtime: '123456', + permissions: OC.PERMISSION_READ + }; + var $tr = fileList.add(fileData); + FileActions.display($tr.find('td.filename'), true, fileList); + + var $action = $tr.find('.action.delete'); + + expect($action.hasClass('no-permission')).toEqual(true); + deleteStub.restore(); + }); + it('shows delete hint not when permission to delete', function() { + var deleteStub = sinon.stub(fileList, 'do_delete'); + var fileData = { + id: 18, + type: 'file', + name: 'testName.txt', + path: '/somepath/dir', + mimetype: 'text/plain', + size: '1234', + etag: 'a01234c', + mtime: '123456', + permissions: OC.PERMISSION_DELETE + }; + var $tr = fileList.add(fileData); + FileActions.display($tr.find('td.filename'), true, fileList); + + var $action = $tr.find('.action.delete'); + + expect($action.hasClass('no-permission')).toEqual(false); + deleteStub.restore(); + }); it('passes context to action handler', function() { var actionStub = sinon.stub(); var fileData = { |