mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
Update tests for indeterminate state, fix slashes not being escaped
Signed-off-by: Maximilian Wende <dasisdormax@mailbox.org>
This commit is contained in:
parent
602f50b2d4
commit
7c453b2425
2 changed files with 50 additions and 2 deletions
|
|
@ -384,7 +384,7 @@
|
|||
var _this = this;
|
||||
this.getShareeList().forEach(function(sharee) {
|
||||
var checkBoxId = 'canEdit-' + _this.cid + '-' + sharee.shareWith;
|
||||
checkBoxId = '#' + checkBoxId.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1");
|
||||
checkBoxId = '#' + checkBoxId.replace( /(:|\.|\[|\]|,|=|@|\/)/g, "\\$1");
|
||||
var $edit = _this.$(checkBoxId);
|
||||
if($edit.length === 1) {
|
||||
$edit.prop('checked', sharee.editPermissionState === 'checked');
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue