| commit | 452a5c6fa8d8c150147972bc8031776c4a4d474c | [log] [tgz] |
|---|---|---|
| author | Becky Siegel <beckysiegel@google.com> | Tue May 09 09:59:55 2017 -0700 |
| committer | Becky Siegel <beckysiegel@google.com> | Tue May 09 10:00:39 2017 -0700 |
| tree | e7d87f2fdac44daa5f3e2d3940fae3f408c9aedb | |
| parent | c9a593cc7223555987665493cdbf5c0c3b4e3bd4 [diff] |
Fixes issue that doesn't let api set labels Introduced in a499e3d9382fef139294472f4853d0d8f7e76931. The setLabelValue function in the reply dialog was not updated to correspond with the change breaking gr-label-scores out into a separate element. This change updates the function to work and also adds a unit test. Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=719927 Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=5757 Change-Id: I4727e3f631ce14526f01c3cb9291cbf917c5cfac
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js index 0bb548b..60d3c4f 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js
@@ -177,7 +177,8 @@ }, setLabelValue: function(label, value) { - var selectorEl = this.$$('iron-selector[data-label="' + label + '"]'); + var selectorEl = + this.$.labelScores.$$('iron-selector[data-label="' + label + '"]'); // The selector may not be present if it’s not at the latest patch set. if (!selectorEl) { return; } var item = selectorEl.$$('gr-button[data-value="' + value + '"]');
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html index 253f01c..34ac167 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html
@@ -214,6 +214,17 @@ }); }); + test('setlabelValue', function() { + element._account = {_account_id: 1}; + flushAsynchronousOperations(); + var label = 'Verified'; + var value = '+1'; + element.setLabelValue(label, value); + flushAsynchronousOperations(); + var labels = element.$.labelScores.getLabelValues(); + assert.deepEqual(labels, {'Verified': 1}); + }); + function getActiveElement() { return Polymer.IronOverlayManager.deepActiveElement; }