Skip to content

Commit

Permalink
Merge 2e7b606 into f5cc5da
Browse files Browse the repository at this point in the history
  • Loading branch information
pekam committed Sep 25, 2019
2 parents f5cc5da + 2e7b606 commit b90dbe5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-number-field.html
Expand Up @@ -232,7 +232,7 @@
}

_setValue(value) {
this.value = this.inputElement.value = parseFloat(value);
this.value = this.inputElement.value = String(parseFloat(value));
this.dispatchEvent(new CustomEvent('change', {bubbles: true}));
}

Expand Down
12 changes: 12 additions & 0 deletions test/number-field.html
Expand Up @@ -133,6 +133,18 @@

increaseButton.click();
expect(changeSpy.callCount).to.equal(1);
decreaseButton.click();
expect(changeSpy.callCount).to.equal(2);
});

it('should dispatch single value-changed event when button is clicked', () => {
const spy = sinon.spy();
numberField.addEventListener('value-changed', spy);

increaseButton.click();
expect(spy.callCount).to.equal(1);
decreaseButton.click();
expect(spy.callCount).to.equal(2);
});

it('should not focus input when a button is clicked', () => {
Expand Down

0 comments on commit b90dbe5

Please sign in to comment.