Add hook for notifying when the commit message changes
Motivation for doing this is to detect in Chromium plugin when 'TBR=' is
used and warn that users still have to CR+1 a change to land via the CQ.
More details in
https://bugs.chromium.org/p/chromium/issues/detail?id=665882
Change-Id: I034dd2a14fac10c6ad0ccdbb6a4e101bf6600a58
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html
index 766da84..ec4d13b 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.html
@@ -139,6 +139,17 @@
assert.isTrue(errorStub.calledOnce);
});
+ test('commitmsgedit event', function(done) {
+ var testMsg = 'Test CL commit message';
+ plugin.on(element.EventType.COMMIT_MSG_EDIT, throwErrFn);
+ plugin.on(element.EventType.COMMIT_MSG_EDIT, function(change, msg) {
+ assert.deepEqual(msg, testMsg);
+ assert.isTrue(errorStub.calledOnce);
+ done();
+ });
+ element.handleCommitMessage(null, testMsg);
+ });
+
test('labelchange event', function(done) {
var testChange = {_number: 42};
plugin.on(element.EventType.LABEL_CHANGE, throwErrFn);