Skip to content

Commit

Permalink
Add test on allowUpdating
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmakarov committed Sep 3, 2023
1 parent a9bbb83 commit 39a0e35
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions testing/testcafe/tests/dataGrid/editing/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import createWidget from '../../../helpers/createWidget';
import url from '../../../helpers/getPageUrl';
import DataGrid from '../../../model/dataGrid';

fixture`Test name`
.page(url(__dirname, '../../container.html'));

// T1186997

[{
name: 't1',
expected: true,
onRowUpdating(e: { cancel: Promise<unknown> }) {
e.cancel = new Promise((resolve) => {
setTimeout(() => resolve(true), 0);
});
},
}, {
name: 't2',
expected: true,
onRowUpdating(e: { cancel: boolean }) {
e.cancel = true;
},
}].forEach(({ name, expected, onRowUpdating }) => {
test(`test5 ${name}`, async (t) => {
const dataGrid = new DataGrid('#container');
const dataRow = dataGrid.getDataRow(0);

await t.click(dataRow.getDataCell(1).getLinkEdit());

await t
.typeText(dataRow.getDataCell(0).getEditor().element, 'test text')
.click(dataRow.getDataCell(1).getLinkSave());

await t.expect(dataRow.getDataCell(1).getLinkSave().exists).eql(expected);
}).before(async () => {
await createWidget('dxDataGrid', () => ({
dataSource: [{
ID: 1,
FirstName: 'John',
},
],
columns: [{
dataField: 'FirstName',
caption: 'Firs tName',
}],
height: 400,
editing: {
mode: 'row',
allowUpdating: true,
// allowDeleting: true,
// allowAdding: true,
},
onRowUpdating,
}));
});
});

0 comments on commit 39a0e35

Please sign in to comment.