diff --git a/e2e/testcafe-devextreme/tests/dataGrid/editing.ts b/e2e/testcafe-devextreme/tests/dataGrid/editing.ts index ebe61e97b99f..c4d948bb6e12 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/editing.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/editing.ts @@ -67,14 +67,11 @@ test('Focused cell should be switched to the editing mode after onSaving\'s prom const dataGrid = new DataGrid('#container'); const resolveOnSavingDeferred = ClientFunction(() => (window as any).deferred.resolve()); - // act await t .click(dataGrid.getDataCell(0, 0).element) .typeText(dataGrid.getDataCell(0, 0).element, 'new_value') .pressKey('tab tab'); await resolveOnSavingDeferred(); - - // assert await t.expect(dataGrid.getDataCell(2, 0).isEditCell).ok(); }).before(async () => { await ClientFunction(() => { @@ -101,6 +98,41 @@ test('Focused cell should be switched to the editing mode after onSaving\'s prom }); }); +test('DataGrid - The "Cannot read properties of undefined error" occurs when using Tab while saving a promise (T1190566)', async (t) => { + const dataGrid = new DataGrid('#container'); + const resolveOnSavingDeferred = ClientFunction(() => (window as any).deferred.resolve()); + + await t + .click(dataGrid.getDataCell(0, 0).element) + .typeText(dataGrid.getDataCell(0, 0).element, 'new_value') + .pressKey('enter tab tab'); + await resolveOnSavingDeferred(); + await t.expect(dataGrid.getDataCell(2, 0).isFocused).ok(); +}).before(async () => { + await ClientFunction(() => { + (window as any).deferred = $.Deferred(); + })(); + + return createWidget('dxDataGrid', { + dataSource: [ + { id: 1, field1: 'value1' }, + { id: 2, field1: 'value2' }, + { id: 3, field1: 'value3' }, + { id: 4, field1: 'value4' }, + ], + keyExpr: 'id', + showBorders: true, + columns: ['field1'], + editing: { + mode: 'cell', + allowUpdating: true, + }, + onSaving(e) { + e.promise = (window as any).deferred; + }, + }); +}); + test('Tab key on editor should focus next cell if editing mode is cell', async (t) => { const dataGrid = new DataGrid('#container'); diff --git a/packages/devextreme/js/__internal/grids/grid_core/validating/m_validating.ts b/packages/devextreme/js/__internal/grids/grid_core/validating/m_validating.ts index 5cdf2905f603..f5b9733c2b6f 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/validating/m_validating.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/validating/m_validating.ts @@ -844,7 +844,7 @@ export const validatingEditingExtender = (Base: ModuleType) = // eslint-disable-next-line @typescript-eslint/no-unused-vars protected _beforeSaveEditData(change, editIndex?) { let result: any = super._beforeSaveEditData.apply(this, arguments as any); - const validationData = this._validatingController._getValidationData(change?.key); + const validationData = this._validatingController._getValidationData(change?.key, true); if (change) { const isValid = change.type === 'remove' || validationData.isValid;