-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix react async templates editing cell template issue. - Add e2e test cases.
- Loading branch information
Ilya Vinogradov
committed
Apr 13, 2023
1 parent
ab3a838
commit 7172f09
Showing
6 changed files
with
146 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ClientFunction } from 'testcafe'; | ||
|
||
export const makeRowsViewTemplatesAsync = async (selector: string): Promise<void> => { | ||
await ClientFunction(() => { | ||
const dataGrid = ($(selector) as any).dxDataGrid('instance'); | ||
|
||
const rowsView = dataGrid.getView('rowsView'); | ||
const originRender = rowsView.renderDelayedTemplates.bind(rowsView); | ||
rowsView.renderDelayedTemplates = (changes) => { | ||
setTimeout(() => { originRender(changes); }); | ||
}; | ||
}, { | ||
dependencies: { selector }, | ||
})(); | ||
}; |
63 changes: 63 additions & 0 deletions
63
testing/testcafe/tests/dataGrid/keyboardNavigation/editOnKeyPress.screenshots.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; | ||
import url from '../../../helpers/getPageUrl'; | ||
import createWidget from '../../../helpers/createWidget'; | ||
import DataGrid from '../../../model/dataGrid'; | ||
import { makeRowsViewTemplatesAsync } from '../helpers/asyncTemplates'; | ||
|
||
fixture | ||
.disablePageReloads`Keyboard Navigation - editOnKeyPress` | ||
.page(url(__dirname, '../../container.html')); | ||
|
||
const DATA_GRID_SELECTOR = '#container'; | ||
|
||
[ | ||
{ name: 'input', template: () => $('<input>') }, | ||
{ name: 'div', template: () => $('<div>').text('Hi, I\'m the template!') }, | ||
].forEach(({ name, template }) => { | ||
test(`should render edit cell template without errors, template: ${name}`, async (t) => { | ||
const { takeScreenshot, compareResults } = createScreenshotsComparer(t); | ||
|
||
const dataGrid = new DataGrid(DATA_GRID_SELECTOR); | ||
const dataCell = dataGrid.getDataCell(0, 0); | ||
|
||
await t.click(dataCell.element) | ||
.pressKey('f'); | ||
|
||
await takeScreenshot( | ||
`edit-cell-keypress-with-custom-cell-template_template-${name}.png`, | ||
dataGrid.element, | ||
); | ||
|
||
await t.expect(compareResults.isValid()) | ||
.ok(compareResults.errorMessages()); | ||
}).before(async () => { | ||
await createWidget('dxDataGrid', { | ||
dataSource: [ | ||
{ | ||
data_A: 'data_A', | ||
data_B: 'data_B', | ||
}, | ||
], | ||
columns: [ | ||
{ | ||
dataField: 'data_A', | ||
editCellTemplate: template, | ||
}, | ||
'data_B', | ||
], | ||
keyboardNavigation: { | ||
enabled: true, | ||
editOnKeyPress: true, | ||
enterKeyDirection: 'column', | ||
}, | ||
editing: { | ||
mode: 'cell', | ||
allowUpdating: true, | ||
allowAdding: true, | ||
startEditAction: 'dblClick', | ||
}, | ||
templatesRenderAsynchronously: true, | ||
}); | ||
await makeRowsViewTemplatesAsync(DATA_GRID_SELECTOR); | ||
}); | ||
}); |
Binary file added
BIN
+6.04 KB
...avigation/etalons/edit-cell-keypress-with-custom-cell-template_template-div.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.44 KB
...igation/etalons/edit-cell-keypress-with-custom-cell-template_template-input.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.