Merge "Add ability to hide quick approve button to GrChangeActionsInterface"
This commit is contained in:
@@ -211,6 +211,10 @@
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
_hideQuickApproveAction: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
changeNum: String,
|
||||
changeStatus: String,
|
||||
commitNum: String,
|
||||
@@ -653,7 +657,18 @@
|
||||
return null;
|
||||
},
|
||||
|
||||
hideQuickApproveAction() {
|
||||
this._topLevelSecondaryActions =
|
||||
this._topLevelSecondaryActions.filter(sa => {
|
||||
return sa.key !== QUICK_APPROVE_ACTION.key;
|
||||
});
|
||||
this._hideQuickApproveAction = true;
|
||||
},
|
||||
|
||||
_getQuickApproveAction() {
|
||||
if (this._hideQuickApproveAction) {
|
||||
return null;
|
||||
}
|
||||
const approval = this._getTopMissingApproval();
|
||||
if (!approval) {
|
||||
return null;
|
||||
|
@@ -1091,6 +1091,21 @@ limitations under the License.
|
||||
assert.isNotNull(approveButton);
|
||||
});
|
||||
|
||||
test('hide quick approve', () => {
|
||||
const approveButton =
|
||||
element.$$('gr-button[data-action-key=\'review\']');
|
||||
assert.isNotNull(approveButton);
|
||||
assert.isFalse(element._hideQuickApproveAction);
|
||||
|
||||
// Assert approve button gets removed from list of buttons.
|
||||
element.hideQuickApproveAction();
|
||||
flushAsynchronousOperations();
|
||||
const approveButtonUpdated =
|
||||
element.$$('gr-button[data-action-key=\'review\']');
|
||||
assert.isNull(approveButtonUpdated);
|
||||
assert.isTrue(element._hideQuickApproveAction);
|
||||
});
|
||||
|
||||
test('is first in list of secondary actions', () => {
|
||||
const approveButton = element.$.secondaryActions
|
||||
.querySelector('gr-button');
|
||||
|
@@ -62,6 +62,11 @@
|
||||
});
|
||||
};
|
||||
|
||||
GrChangeActionsInterface.prototype.hideQuickApproveAction = function() {
|
||||
ensureEl(this);
|
||||
this._el.hideQuickApproveAction();
|
||||
};
|
||||
|
||||
GrChangeActionsInterface.prototype.setActionOverflow = function(type, key,
|
||||
overflow) {
|
||||
ensureEl(this);
|
||||
|
Reference in New Issue
Block a user