diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js index 28935ce3e4..661a296742 100644 --- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js +++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js @@ -88,7 +88,7 @@ _handleTopicChanged: function(e, topic) { if (!topic.length) { topic = null; } - this.$.restAPI.setChangeTopic(this.change.id, topic); + this.$.restAPI.setChangeTopic(this.change.change_id, topic); }, _computeTopicReadOnly: function(mutable, change) { diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html index 218e124813..22080e8705 100644 --- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html +++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html @@ -85,6 +85,8 @@ limitations under the License. sandbox.stub(element, '_computeValueTooltip').returns(''); sandbox.stub(element, '_computeTopicReadOnly').returns(true); element.change = { + change_id: 'the id', + topic: 'the topic', status: 'NEW', submit_type: 'CHERRY_PICK', labels: { @@ -145,6 +147,13 @@ limitations under the License. done(); }); }); + + test('changing topic calls setChangeTopic', function() { + var topicStub = sandbox.stub(element.$.restAPI, 'setChangeTopic', + function() {}); + element._handleTopicChanged({}, 'the new topic'); + assert.isTrue(topicStub.calledWith('the id', 'the new topic')); + }); }); });