Suggest label score plugin sample

Change-Id: I746ebd99c97d10e921b196ba8d219e50a4f84a2d
This commit is contained in:
Viktar Donich
2018-02-28 14:41:58 -08:00
parent d98793ded8
commit 3ae72b3526
9 changed files with 89 additions and 9 deletions

View File

@@ -73,5 +73,20 @@
});
};
GrChangeReplyInterface.prototype.addLabelValuesChangedCallback =
function(handler) {
this.plugin.hook('reply-label-scores').onAttached(el => {
if (!el.content) { return; }
el.content.addEventListener('labels-changed', e => {
handler(e.detail);
});
});
};
GrChangeReplyInterface.prototype.showMessage = function(message) {
return this._el.setPluginMessage(message);
};
window.GrChangeReplyInterface = GrChangeReplyInterface;
})(window);

View File

@@ -78,6 +78,10 @@ breaking changes to gr-reply-dialog wont be noticed.
sandbox.stub(element, 'send');
changeReply.send(false);
assert.isTrue(element.send.calledWithExactly(false));
sandbox.stub(element, 'setPluginMessage');
changeReply.showMessage('foobar');
assert.isTrue(element.setPluginMessage.calledWithExactly('foobar'));
});
});
@@ -105,6 +109,10 @@ breaking changes to gr-reply-dialog wont be noticed.
sandbox.stub(element, 'send');
changeReply.send(false);
assert.isTrue(element.send.calledWithExactly(false));
sandbox.stub(element, 'setPluginMessage');
changeReply.showMessage('foobar');
assert.isTrue(element.setPluginMessage.calledWithExactly('foobar'));
});
});
});