-
Notifications
You must be signed in to change notification settings - Fork 665
T1308327 - DataGrid - Cell value is not restored after canceling changes in cell editing mode if repaintChangesOnly is enabled #32290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 26_1
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
…he revert button get access to initial values via _getOldData()
6c9703a to
7001075
Compare
There was a problem hiding this 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.
| 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(); | ||
| }; | ||
|
|
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
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.
| 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'; |
No description provided.