diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2015-04-24 11:57:47 +0200 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2015-04-24 11:57:47 +0200 |
commit | 5b998e13d7b54de9d9c9f17205720f280b8e72cc (patch) | |
tree | 8d7957d5cc2f66e07493b7c5fec453b74184a50e /apps/files/tests/js/fileactionsSpec.js | |
parent | 33d197db29bcaded7b22c0d81e4e2f92004e9398 (diff) | |
parent | f4bc852db3376f5e602c1970fe76b8698e26f32e (diff) | |
download | nextcloud-server-5b998e13d7b54de9d9c9f17205720f280b8e72cc.tar.gz nextcloud-server-5b998e13d7b54de9d9c9f17205720f280b8e72cc.zip |
Merge pull request #15835 from owncloud/delete-permission-icon
Show hint if there is no delete permission
Diffstat (limited to 'apps/files/tests/js/fileactionsSpec.js')
-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 = { |