summaryrefslogtreecommitdiffstats
path: root/core/js/tests/specs
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-10-31 12:12:24 +0100
committerJulius Härtl <jus@bitgrid.net>2018-10-31 12:12:24 +0100
commit95e34407bf07fbcb2d1a3d362e7685977f85f8d5 (patch)
treed994fcf2226d73cfb8de34c2d7c328aa1e671fdd /core/js/tests/specs
parent2c990ade77f73ce4cde7ecd7cb4ef116e1b8cd8d (diff)
downloadnextcloud-server-95e34407bf07fbcb2d1a3d362e7685977f85f8d5.tar.gz
nextcloud-server-95e34407bf07fbcb2d1a3d362e7685977f85f8d5.zip
Add tests for edit permission state on file shares
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/js/tests/specs')
-rw-r--r--core/js/tests/specs/sharedialogshareelistview.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js
index 8e34225d199..e51fc2df72d 100644
--- a/core/js/tests/specs/sharedialogshareelistview.js
+++ b/core/js/tests/specs/sharedialogshareelistview.js
@@ -90,6 +90,37 @@ describe('OC.Share.ShareDialogShareeListView', function () {
});
describe('Sets correct initial checkbox state', function () {
+
+ it('marks edit box as unchecked for file shares without edit permissions', function () {
+ shareModel.set('shares', [{
+ id: 100,
+ item_source: 123,
+ permissions: 1,
+ share_type: OC.Share.SHARE_TYPE_USER,
+ share_with: 'user1',
+ share_with_displayname: 'User One',
+ uid_owner: oc_current_user,
+ itemType: 'file'
+ }]);
+ listView.render();
+ expect(listView.$el.find("input[name='edit']").is(':not(:checked)')).toEqual(true);
+ });
+
+ it('marks edit box as checked for file shares', 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',
+ uid_owner: oc_current_user,
+ itemType: 'file'
+ }]);
+ listView.render();
+ expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true);
+ });
+
it('marks edit box as indeterminate when only some permissions are given', function () {
shareModel.set('shares', [{
id: 100,