Skip to content

Commit 058a720

Browse files
Merge branch '26_1' into 26_1_global_format
2 parents df75349 + e301f33 commit 058a720

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

packages/devextreme/js/__internal/ui/date_box/date_box.mask.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,16 @@ class DateBoxMask extends DateBoxBase {
716716
return this._maskValue?.getTime() !== value?.getTime();
717717
}
718718

719+
_hasEditorSpecificValidationError(): boolean {
720+
const { isValid, validationError } = this.option();
721+
722+
return !isValid && Boolean(validationError?.editorSpecific);
723+
}
724+
719725
_fireChangeEvent(): void {
720726
this._clearSearchValue();
721727

722-
if (this._isValueDirty()) {
728+
if (this._isValueDirty() || this._hasEditorSpecificValidationError()) {
723729
eventsEngine.triggerHandler(this._input(), { type: 'change' });
724730
}
725731
}

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/datebox.mask.tests.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,34 @@ module('Regression', () => {
16721672

16731673
assert.strictEqual($input.val(), '12:34', 'both digits go to hours and minutes stay unchanged');
16741674
});
1675+
1676+
QUnit.test('should be valid when date returns to valid range after out-of-range change (T1326750)', function(assert) {
1677+
const $dateBox = $('#dateBox').dxDateBox({
1678+
useMaskBehavior: true,
1679+
pickerType: 'calendar',
1680+
type: 'date',
1681+
displayFormat: 'dd-MM-yyyy',
1682+
value: new Date(2020, 2, 31),
1683+
min: new Date(2018, 3, 1),
1684+
max: new Date(2020, 2, 31),
1685+
});
1686+
1687+
const instance = $dateBox.dxDateBox('instance');
1688+
const $input = $dateBox.find(`.${TEXT_EDITOR_INPUT_CLASS}`);
1689+
const keyboard = keyboardMock($input, true);
1690+
1691+
keyboard.press('right').press('right');
1692+
1693+
keyboard.press('up');
1694+
keyboard.press('enter');
1695+
1696+
assert.strictEqual(instance.option('isValid'), false, 'should be invalid when year 2021 exceeds max date');
1697+
1698+
keyboard.press('down');
1699+
keyboard.press('enter');
1700+
1701+
assert.strictEqual(instance.option('isValid'), true, 'should be valid when year returns to 2020');
1702+
});
16751703
});
16761704

16771705
module('Caret moving', setupModule, () => {

0 commit comments

Comments
 (0)