Merge "Fix special cases with global capabilities"
This commit is contained in:
@@ -62,9 +62,9 @@ limitations under the License.
|
||||
padding: .7em;
|
||||
}
|
||||
#editBtn,
|
||||
.editing #editBtn.global,
|
||||
#deletedContainer,
|
||||
.deleted #mainContainer,
|
||||
.global,
|
||||
#addPermission,
|
||||
#updateBtns,
|
||||
.editingRef .header,
|
||||
|
||||
@@ -104,6 +104,10 @@
|
||||
});
|
||||
},
|
||||
|
||||
_computeHideEditClass(section) {
|
||||
return section.id === 'GLOBAL_CAPABILITIES' ? 'hide' : '';
|
||||
},
|
||||
|
||||
_computeLabelOptions(labels) {
|
||||
const labelOptions = [];
|
||||
for (const labelName of Object.keys(labels)) {
|
||||
|
||||
@@ -354,6 +354,8 @@ limitations under the License.
|
||||
assert.isFalse(element.$.section.classList.contains('editing'));
|
||||
assert.isFalse(element.$.section.classList.contains('deleted'));
|
||||
assert.isTrue(element.$.editBtn.classList.contains('global'));
|
||||
element.editing = true;
|
||||
assert.equal(getComputedStyle(element.$.editBtn).display, 'none');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -378,6 +380,8 @@ limitations under the License.
|
||||
assert.isFalse(element.$.section.classList.contains('editing'));
|
||||
assert.isFalse(element.$.section.classList.contains('deleted'));
|
||||
assert.isFalse(element.$.editBtn.classList.contains('global'));
|
||||
element.editing = true;
|
||||
assert.notEqual(getComputedStyle(element.$.editBtn).display, 'none');
|
||||
});
|
||||
|
||||
test('add permission', () => {
|
||||
|
||||
@@ -89,7 +89,7 @@ limitations under the License.
|
||||
<div class="header">
|
||||
<span class="title">[[name]]</span>
|
||||
<div class="right">
|
||||
<template is=dom-if if="[[!_permissionIsOwner(permission.id)]]">
|
||||
<template is=dom-if if="[[!_permissionIsOwnerOrGlobal(permission.id, section)]]">
|
||||
<paper-toggle-button
|
||||
id="exclusiveToggle"
|
||||
checked="{{permission.value.exclusive}}"
|
||||
|
||||
@@ -89,8 +89,8 @@
|
||||
this._setupValues();
|
||||
},
|
||||
|
||||
_permissionIsOwner(permissionId) {
|
||||
return permissionId === 'owner';
|
||||
_permissionIsOwnerOrGlobal(permissionId, section) {
|
||||
return permissionId === 'owner' || section === 'GLOBAL_CAPABILITIES';
|
||||
},
|
||||
|
||||
_handleEditingChanged(editing, editingOld) {
|
||||
|
||||
@@ -362,6 +362,15 @@ limitations under the License.
|
||||
assert.equal(getComputedStyle(element.$$('#exclusiveToggle')).display,
|
||||
'none');
|
||||
});
|
||||
|
||||
test('Exclusive hidden for any global permissions', () => {
|
||||
assert.equal(getComputedStyle(element.$$('#exclusiveToggle')).display,
|
||||
'flex');
|
||||
element.section = 'GLOBAL_CAPABILITIES';
|
||||
flushAsynchronousOperations();
|
||||
assert.equal(getComputedStyle(element.$$('#exclusiveToggle')).display,
|
||||
'none');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user