Add setIcon function to gr-change-actions-js-api

Change-Id: I937009516b1a962bab58ef3f8feecacd24643abd
This commit is contained in:
Kasper Nilsson
2018-06-04 10:20:33 -07:00
parent c0b6854e7b
commit 9ee6c78d75
2 changed files with 8 additions and 0 deletions

View File

@@ -119,6 +119,11 @@
this._el.setActionButtonProp(key, 'enabled', enabled);
};
GrChangeActionsInterface.prototype.setIcon = function(key, icon) {
ensureEl(this);
this._el.setActionButtonProp(key, 'icon', icon);
};
GrChangeActionsInterface.prototype.getActionDetails = function(action) {
ensureEl(this);
return this._el.getActionDetails(action) ||

View File

@@ -144,9 +144,12 @@ breaking changes to gr-change-actions wont be noticed.
assert.isNotOk(button.disabled);
changeActions.setLabel(key, 'Yo');
changeActions.setEnabled(key, false);
changeActions.setIcon(key, 'pupper');
flush(() => {
assert.equal(button.getAttribute('data-label'), 'Yo');
assert.isTrue(button.disabled);
assert.equal(Polymer.dom(button).querySelector('iron-icon').icon,
'gr-icons:pupper');
done();
});
});