diff options
author | Maximilian Wende <dasisdormax@mailbox.org> | 2018-02-16 11:42:41 +0100 |
---|---|---|
committer | Maximilian Wende <dasisdormax@mailbox.org> | 2018-02-16 11:42:41 +0100 |
commit | 7c453b24259a9a6fa03bb26cc2213013ecff4b8e (patch) | |
tree | f0dc4b7c87f6667dfa3aa6300af941666b953c67 /core/js/tests | |
parent | 602f50b2d4781cd9a874e7354b44315d6c0debb5 (diff) | |
download | nextcloud-server-7c453b24259a9a6fa03bb26cc2213013ecff4b8e.tar.gz nextcloud-server-7c453b24259a9a6fa03bb26cc2213013ecff4b8e.zip |
Update tests for indeterminate state, fix slashes not being escaped
Signed-off-by: Maximilian Wende <dasisdormax@mailbox.org>
Diffstat (limited to 'core/js/tests')
-rw-r--r-- | core/js/tests/specs/sharedialogshareelistview.js | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js index 8ee2c48fe39..cc0268ba580 100644 --- a/core/js/tests/specs/sharedialogshareelistview.js +++ b/core/js/tests/specs/sharedialogshareelistview.js @@ -89,6 +89,37 @@ describe('OC.Share.ShareDialogShareeListView', function () { updateShareStub.restore(); }); + describe('Sets correct initial checkbox state', function () { + it('marks edit box as indeterminate when only some permissions are given', function () { + shareModel.set('shares', [{ + id: 100, + item_source: 123, + permissions: 1 | OC.PERMISSION_UPDATE, + share_type: OC.Share.SHARE_TYPE_USER, + share_with: 'user1', + share_with_displayname: 'User One', + itemType: 'folder' + }]); + shareModel.set('itemType', 'folder'); + listView.render(); + expect(listView.$el.find("input[name='edit']").is(':indeterminate')).toEqual(true); + }); + + it('Checks edit box when all permissions are given', function () { + shareModel.set('shares', [{ + id: 100, + item_source: 123, + permissions: 1 | OC.PERMISSION_CREATE | OC.PERMISSION_UPDATE | OC.PERMISSION_DELETE, + share_type: OC.Share.SHARE_TYPE_USER, + share_with: 'user1', + share_with_displayname: 'User One', + itemType: 'folder' + }]); + shareModel.set('itemType', 'folder'); + listView.render(); + expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true); + }); + }); describe('Manages checkbox events correctly', function () { it('Checks cruds boxes when edit box checked', function () { shareModel.set('shares', [{ @@ -106,7 +137,7 @@ describe('OC.Share.ShareDialogShareeListView', function () { expect(updateShareStub.calledOnce).toEqual(true); }); - it('Checks edit box when create/update/delete are checked', function () { + it('marks edit box as indeterminate when some of create/update/delete are checked', function () { shareModel.set('shares', [{ id: 100, item_source: 123, @@ -119,6 +150,23 @@ describe('OC.Share.ShareDialogShareeListView', function () { shareModel.set('itemType', 'folder'); listView.render(); listView.$el.find("input[name='update']").click(); + expect(listView.$el.find("input[name='edit']").is(':indeterminate')).toEqual(true); + expect(updateShareStub.calledOnce).toEqual(true); + }); + + it('Checks edit box when all of create/update/delete are checked', function () { + shareModel.set('shares', [{ + id: 100, + item_source: 123, + permissions: 1 | OC.PERMISSION_CREATE | OC.PERMISSION_DELETE, + share_type: OC.Share.SHARE_TYPE_USER, + share_with: 'user1', + share_with_displayname: 'User One', + itemType: 'folder' + }]); + shareModel.set('itemType', 'folder'); + listView.render(); + listView.$el.find("input[name='update']").click(); expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true); expect(updateShareStub.calledOnce).toEqual(true); }); |