Skip to content

Commit

Permalink
fix: do not throw error with incorrect value attribute (#4176) (#4178)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Kulykov <[email protected]>
  • Loading branch information
vaadin-bot and web-padawan authored Jul 12, 2022
1 parent 6cd5def commit 5c4b7b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/time-picker/src/vaadin-time-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
const newValue = this.__formatISO(parsedObj) || '';

if (this.value !== '' && this.value !== null && !parsedObj) {
this.value = oldValue;
this.value = oldValue === undefined ? '' : oldValue;
} else if (this.value !== newValue) {
this.value = newValue;
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/time-picker/test/form-input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,10 @@ describe('form input', () => {
expect(timePicker.invalid).to.equal(false);
});
});

describe('incorrect value', () => {
it('should not throw error when setting incorrect value using attribute', () => {
expect(() => fixtureSync(`<vaadin-time-picker value="1500"></vaadin-time-picker>`)).to.not.throw(Error);
});
});
});

0 comments on commit 5c4b7b9

Please sign in to comment.