Skip to content

Commit

Permalink
Merge 3603510 into 83f2943
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Jun 12, 2020
2 parents 83f2943 + 3603510 commit 1d0584b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vaadin-text-field-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,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
Expand Down Expand Up @@ -436,7 +438,6 @@
}

if (this.__userInput) {
this.__userInput = false;
return;
} else if (newVal !== undefined) {
this.inputElement.value = newVal;
Expand Down
20 changes: 20 additions & 0 deletions test/text-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,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;

Expand Down

0 comments on commit 1d0584b

Please sign in to comment.