Skip to content

Commit 6e47019

Browse files
ugur-vaadinvursen
andauthored
fix!: do not adjust values that are out of allowed range (#5289)
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
1 parent 94c9b85 commit 6e47019

2 files changed

Lines changed: 0 additions & 42 deletions

File tree

‎packages/time-picker/src/vaadin-time-picker.js‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
546546
const maxTimeObj = this.__validateTime(this.__parseISO(max || MAX_ALLOWED_TIME));
547547
const maxSec = this.__getSec(maxTimeObj);
548548

549-
this.__adjustValue(minSec, maxSec, minTimeObj, maxTimeObj);
550-
551549
this.__dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
552550

553551
if (step !== this.__oldStep) {
@@ -585,22 +583,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
585583
return generatedList;
586584
}
587585

588-
/** @private */
589-
__adjustValue(minSec, maxSec, minTimeObj, maxTimeObj) {
590-
// Do not change the value if it is empty
591-
if (!this.__memoValue) {
592-
return;
593-
}
594-
595-
const valSec = this.__getSec(this.__memoValue);
596-
597-
if (valSec < minSec) {
598-
this.__updateValue(minTimeObj);
599-
} else if (valSec > maxSec) {
600-
this.__updateValue(maxTimeObj);
601-
}
602-
}
603-
604586
/**
605587
* Override an observer from `InputMixin`.
606588
* @protected

‎packages/time-picker/test/time-picker.test.js‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -432,30 +432,6 @@ describe('time-picker', () => {
432432
expect(timePicker.max).to.be.equal('19:00');
433433
});
434434

435-
it('should not allow setting a value lower than min property value', () => {
436-
timePicker.value = '02:00';
437-
timePicker.min = '10:00';
438-
expect(timePicker.value).to.be.equal('10:00');
439-
});
440-
441-
it('should not allow setting a value higher than max property value', () => {
442-
timePicker.value = '12:00';
443-
timePicker.max = '10:00';
444-
expect(timePicker.value).to.be.equal('10:00');
445-
});
446-
447-
it('should not allow setting a value lower than min value via attribute', () => {
448-
timePicker.setAttribute('value', '02:00');
449-
timePicker.setAttribute('min', '10:00');
450-
expect(timePicker.value).to.be.equal('10:00');
451-
});
452-
453-
it('should not allow setting a value higher than max value via attribute', () => {
454-
timePicker.setAttribute('value', '19:00');
455-
timePicker.setAttribute('max', '16:00');
456-
expect(timePicker.value).to.be.equal('16:00');
457-
});
458-
459435
it('setting min should not change an empty value', () => {
460436
timePicker.min = '10:00';
461437
expect(timePicker.value).to.be.equal('');

0 commit comments

Comments
 (0)