Skip to content

Commit

Permalink
fix(number-field): reflect to attribute properly (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Jun 14, 2019
1 parent 22af86b commit d4f2584
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/vaadin-number-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@
*/
min: {
type: Number,
reflectToAttribue: true
reflectToAttribute: true
},

/**
* The maximum value of the field.
*/
max: {
type: Number,
reflectToAttribue: true,
reflectToAttribute: true,
observer: '_maxChanged'
},

Expand All @@ -119,7 +119,7 @@
*/
step: {
type: Number,
reflectToAttribue: true,
reflectToAttribute: true,
value: 1
}

Expand Down
14 changes: 12 additions & 2 deletions test/number-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
increaseButton = numberField.root.querySelector('[part=increase-button]');
});

describe('properties', () => {
['min', 'max', 'step'].forEach(prop => {
it(`should reflect "${prop}" property to attribute`, () => {
var value = 5;
numberField[prop] = value;
expect(numberField.getAttribute(prop)).to.be.equal(String(value));
});
});
});

describe('native', () => {

it('should have [type=number]', () => {
Expand Down Expand Up @@ -528,7 +538,7 @@
expect(numberField.value).to.be.equal('19');
});

it(`should set value to the first step value above zero when min is below zero
it(`should set value to the first step value above zero when min is below zero
and max is above zero and increaseButton is clicked`, () => {
numberField.min = -19;
numberField.max = 19;
Expand Down Expand Up @@ -569,7 +579,7 @@
expect(numberField.value).to.be.equal('-3');
});

it(`should set value to the first step value below zero when min is below zero and max
it(`should set value to the first step value below zero when min is below zero and max
is above zero and decreaseButton is clicked`, () => {
numberField.min = -19;
numberField.max = 19;
Expand Down

0 comments on commit d4f2584

Please sign in to comment.