Merge "Fix special cases with global capabilities"

This commit is contained in:
Kasper Nilsson
2018-01-22 21:21:23 +00:00
committed by Gerrit Code Review
6 changed files with 21 additions and 4 deletions

View File

@@ -62,9 +62,9 @@ limitations under the License.
padding: .7em;
}
#editBtn,
.editing #editBtn.global,
#deletedContainer,
.deleted #mainContainer,
.global,
#addPermission,
#updateBtns,
.editingRef .header,

View File

@@ -104,6 +104,10 @@
});
},
_computeHideEditClass(section) {
return section.id === 'GLOBAL_CAPABILITIES' ? 'hide' : '';
},
_computeLabelOptions(labels) {
const labelOptions = [];
for (const labelName of Object.keys(labels)) {

View File

@@ -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', () => {

View File

@@ -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}}"

View File

@@ -89,8 +89,8 @@
this._setupValues();
},
_permissionIsOwner(permissionId) {
return permissionId === 'owner';
_permissionIsOwnerOrGlobal(permissionId, section) {
return permissionId === 'owner' || section === 'GLOBAL_CAPABILITIES';
},
_handleEditingChanged(editing, editingOld) {

View File

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