diff --git a/src/vaadin-text-field-mixin.html b/src/vaadin-text-field-mixin.html index 07e7e42a..ae9cc35d 100644 --- a/src/vaadin-text-field-mixin.html +++ b/src/vaadin-text-field-mixin.html @@ -427,7 +427,9 @@ if (!e.__fromClearButton) { this.__userInput = true; } + this.value = e.target.value; + this.__userInput = false; } // NOTE(yuriy): Workaround needed for IE11 and Edge for proper displaying @@ -484,7 +486,6 @@ } if (this.__userInput) { - this.__userInput = false; return; } else if (newVal !== undefined) { this.inputElement.value = newVal; diff --git a/test/text-field.html b/test/text-field.html index 2cc8c56a..13bc9106 100644 --- a/test/text-field.html +++ b/test/text-field.html @@ -567,6 +567,26 @@ }); + describe('value property', function() { + let textField, input; + + beforeEach(function() { + textField = fixture(`default${fixtureName}`); + input = textField.inputElement; + }); + + it('should not consider updating the value as user input if the value is not changed', () => { + const event = new Event('input', { + bubbles: true, + cancelable: true + }); + input.dispatchEvent(event); + + textField.value = 'foo'; + expect(input.value).to.equal('foo'); + }); + }); + describe(`events ${condition}`, function() { let textField, input;