Add tests for edit permission state on file shares

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-10-31 12:12:24 +01:00
parent 2c990ade77
commit 95e34407bf
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 31 additions and 0 deletions

View File

@ -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,