Don't show exclusive toggle for 'owner' permissions
In the GWT UI, the checkbox is always disabled. The owner permission does not allow exclusive to be set. This change only shows the exclusive toggle if the permission is not 'owner' Change-Id: I3a3be5aefd661c84e51a84900b3eade6b4b6ef60
This commit is contained in:
@@ -89,11 +89,13 @@ limitations under the License.
|
||||
<div class="header">
|
||||
<span class="title">[[name]]</span>
|
||||
<div class="right">
|
||||
<paper-toggle-button
|
||||
id="exclusiveToggle"
|
||||
checked="{{permission.value.exclusive}}"
|
||||
on-change="_handleValueChange"
|
||||
disabled$="[[!editing]]"></paper-toggle-button>Exclusive
|
||||
<template is=dom-if if="[[!_permissionIsOwner(permission.id)]]">
|
||||
<paper-toggle-button
|
||||
id="exclusiveToggle"
|
||||
checked="{{permission.value.exclusive}}"
|
||||
on-change="_handleValueChange"
|
||||
disabled$="[[!editing]]"></paper-toggle-button>Exclusive
|
||||
</template>
|
||||
<gr-button
|
||||
link
|
||||
id="removeBtn"
|
||||
|
||||
@@ -89,6 +89,10 @@
|
||||
this._setupValues();
|
||||
},
|
||||
|
||||
_permissionIsOwner(permissionId) {
|
||||
return permissionId === 'owner';
|
||||
},
|
||||
|
||||
_handleEditingChanged(editing, editingOld) {
|
||||
// Ignore when editing gets set initially.
|
||||
if (!editingOld) { return; }
|
||||
|
||||
@@ -335,7 +335,7 @@ limitations under the License.
|
||||
|
||||
assert.isFalse(element._originalExclusiveValue);
|
||||
assert.isNotOk(element.permission.value.modified);
|
||||
MockInteractions.tap(element.$.exclusiveToggle);
|
||||
MockInteractions.tap(element.$$('#exclusiveToggle'));
|
||||
flushAsynchronousOperations();
|
||||
assert.isTrue(element.permission.value.exclusive);
|
||||
assert.isTrue(element.permission.value.modified);
|
||||
@@ -353,6 +353,15 @@ limitations under the License.
|
||||
assert.isTrue(element.permission.value.modified);
|
||||
assert.isTrue(modifiedHandler.called);
|
||||
});
|
||||
|
||||
test('Exclusive hidden for owner permission', () => {
|
||||
assert.equal(getComputedStyle(element.$$('#exclusiveToggle')).display,
|
||||
'flex');
|
||||
element.set(['permission', 'id'], 'owner');
|
||||
flushAsynchronousOperations();
|
||||
assert.equal(getComputedStyle(element.$$('#exclusiveToggle')).display,
|
||||
'none');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user