Relay the bind-value-changed event from gr-textarea

The reply dialog listens for bind-value-changed on its textarea so that
the dialog can be repositioned. However, when the textarea had been
upgraded from an iron-autogrow-textarea to a specialized gr-textarea,
the bind-value-changed events were being swallowed. With this change,
gr-textarea's handler for these events relays them for handling above.

Bug: Issue 6768
Change-Id: Ida6ffd37ce37055e260ab196de2e5f5118c0e682
This commit is contained in:
Wyatt Allen
2017-08-02 10:24:33 -07:00
parent 29434943c7
commit 643cc71240
2 changed files with 15 additions and 0 deletions

View File

@@ -53,6 +53,10 @@
Polymer({
is: 'gr-textarea',
/**
* @event bind-value-changed
*/
properties: {
autocomplete: Boolean,
disabled: Boolean,
@@ -240,6 +244,9 @@
* autocomplete options.
*/
_onValueChanged(e) {
// Relay the event.
this.fire('bind-value-changed', e);
// If cursor is not in textarea (just opened with colon as last char),
// Don't do anything.
if (!e.currentTarget.focused) { return; }

View File

@@ -196,6 +196,14 @@ limitations under the License.
assert.isTrue(resetSpy.called);
});
test('_onValueChanged fires bind-value-changed', () => {
const listenerStub = sinon.stub();
const eventObject = {currentTarget: {focused: false}};
element.addEventListener('bind-value-changed', listenerStub);
element._onValueChanged(eventObject);
assert.isTrue(listenerStub.called);
});
suite('keyboard shortcuts', () => {
function setupDropdown() {
MockInteractions.focus(element.$.textarea);