Add setTitle function to assign hint message.

Change-Id: I5bafb0e591598dc9eb31f1ff4cfb3fad14682596
This commit is contained in:
Chih-Hung Hsieh
2018-06-15 18:14:45 -07:00
parent 5cbde4dd8e
commit 5c22266b88
2 changed files with 7 additions and 0 deletions

View File

@@ -114,6 +114,11 @@
this._el.setActionButtonProp(key, 'label', text);
};
GrChangeActionsInterface.prototype.setTitle = function(key, text) {
ensureEl(this);
this._el.setActionButtonProp(key, 'title', text);
};
GrChangeActionsInterface.prototype.setEnabled = function(key, enabled) {
ensureEl(this);
this._el.setActionButtonProp(key, 'enabled', enabled);

View File

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