Skip to content

Conversation

@Raushen
Copy link
Contributor

@Raushen Raushen commented Jan 23, 2026

No description provided.

@Raushen Raushen self-assigned this Jan 23, 2026
@Raushen Raushen requested a review from a team as a code owner January 23, 2026 13:46
Copilot AI review requested due to automatic review settings January 23, 2026 13:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive integration test to verify the fix for T1308327, which addresses an issue where DataGrid cell values were not properly restored after canceling changes in cell editing mode when repaintChangesOnly is enabled. The test ensures that validation states are correctly reset along with the cell values.

Changes:

  • Added new integration test for validating cell value restoration after cancel with validation errors
  • Extended test model infrastructure to support interaction with revert buttons and cell editors
  • Verified the fix works for multiple consecutive cell edits and cancellations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/devextreme/js/__internal/grids/grid_core/validating/tests/validating.integration.test.ts New integration test file verifying cell value restoration when canceling edits with validation errors in repaintChangesOnly mode
packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/grid_core.ts Added getRevertButton() helper method to enable test interaction with validation revert buttons
packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/cell/data_cell.ts Added getEditor() helper method to retrieve and interact with cell editors in tests

Raushen and others added 2 commits January 29, 2026 11:54
…he revert button get access to initial values via _getOldData()
Copilot AI review requested due to automatic review settings January 29, 2026 07:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +4 to +60
import type { dxElementWrapper } from '@js/core/renderer';
import $ from '@js/core/renderer';
import type { Properties as DataGridProperties } from '@js/ui/data_grid';
import DataGrid from '@js/ui/data_grid';
import errors from '@js/ui/widget/ui.errors';
import { DataGridModel } from '@ts/grids/data_grid/__tests__/__mock__/model/data_grid';

const SELECTORS = {
gridContainer: '#gridContainer',
};

const GRID_CONTAINER_ID = 'gridContainer';

const createDataGrid = async (
options: DataGridProperties = {},
): Promise<{
$container: dxElementWrapper;
component: DataGridModel;
instance: DataGrid;
}> => new Promise((resolve) => {
const $container = $('<div>')
.attr('id', GRID_CONTAINER_ID)
.appendTo(document.body);

const dataGridOptions: DataGridProperties = {
keyExpr: 'id',
...options,
};

const instance = new DataGrid($container.get(0) as HTMLDivElement, dataGridOptions);
const component = new DataGridModel($container.get(0) as HTMLElement);

jest.runAllTimers();

resolve({
$container,
component,
instance,
});
});

const beforeTest = (): void => {
jest.useFakeTimers();
jest.spyOn(errors, 'log').mockImplementation(jest.fn());
jest.spyOn(errors, 'Error').mockImplementation(() => ({}));
};

const afterTest = (): void => {
const $container = $(SELECTORS.gridContainer);
const dataGrid = ($container as any).dxDataGrid('instance') as DataGrid;

dataGrid.dispose();
$container.remove();
jest.clearAllMocks();
jest.useRealTimers();
};

Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test helpers (createDataGrid, beforeTest, afterTest) duplicate code from the shared test utilities in __mock__/helpers/utils.ts. Consider importing and using the shared helpers instead to maintain consistency and reduce code duplication. The shared helper includes fx.off = true in beforeTest to disable animations, which helps ensure test stability.

Suggested change
import type { dxElementWrapper } from '@js/core/renderer';
import $ from '@js/core/renderer';
import type { Properties as DataGridProperties } from '@js/ui/data_grid';
import DataGrid from '@js/ui/data_grid';
import errors from '@js/ui/widget/ui.errors';
import { DataGridModel } from '@ts/grids/data_grid/__tests__/__mock__/model/data_grid';
const SELECTORS = {
gridContainer: '#gridContainer',
};
const GRID_CONTAINER_ID = 'gridContainer';
const createDataGrid = async (
options: DataGridProperties = {},
): Promise<{
$container: dxElementWrapper;
component: DataGridModel;
instance: DataGrid;
}> => new Promise((resolve) => {
const $container = $('<div>')
.attr('id', GRID_CONTAINER_ID)
.appendTo(document.body);
const dataGridOptions: DataGridProperties = {
keyExpr: 'id',
...options,
};
const instance = new DataGrid($container.get(0) as HTMLDivElement, dataGridOptions);
const component = new DataGridModel($container.get(0) as HTMLElement);
jest.runAllTimers();
resolve({
$container,
component,
instance,
});
});
const beforeTest = (): void => {
jest.useFakeTimers();
jest.spyOn(errors, 'log').mockImplementation(jest.fn());
jest.spyOn(errors, 'Error').mockImplementation(() => ({}));
};
const afterTest = (): void => {
const $container = $(SELECTORS.gridContainer);
const dataGrid = ($container as any).dxDataGrid('instance') as DataGrid;
dataGrid.dispose();
$container.remove();
jest.clearAllMocks();
jest.useRealTimers();
};
import type { Properties as DataGridProperties } from '@js/ui/data_grid';
import { DataGridModel } from '@ts/grids/data_grid/__tests__/__mock__/model/data_grid';
import {
createDataGrid,
beforeTest,
afterTest,
} from '@ts/grids/data_grid/__tests__/__mock__/helpers/utils';

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants