diff --git a/e2e/testcafe-devextreme/tests/dataGrid/focus/focus.ts b/e2e/testcafe-devextreme/tests/dataGrid/focus/focus.ts index ec66d94824bb..b3e056b76ab7 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/focus/focus.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/focus/focus.ts @@ -240,3 +240,30 @@ test('DataGrid - FilterRow cell loses focus when focusedRowEnabled is true and e }); }); }); + +['onFocusedRowChanged', 'onFocusedRowChanging'].forEach((event) => { + test(`Focus should be preserved on datagrid when rowsview repaints in ${event} event (T1224663)`, async (t) => { + const dataGrid = new DataGrid('#container'); + + await t + .click(dataGrid.getDataCell(0, 0).element) + .expect(dataGrid.getDataRow(0).isFocusedRow) + .ok(); + + await t + .pressKey('down') + .expect(dataGrid.getDataRow(1).isFocusedRow) + .ok(); + }).before(async () => createWidget('dxDataGrid', { + dataSource: [ + { id: 1, name: 'name 1' }, + { id: 2, name: 'name 2' }, + { id: 3, name: 'name 3' }, + ], + keyExpr: 'id', + focusedRowEnabled: true, + [event]: (e) => { + e.component.repaint(); + }, + })); +}); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.integration.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.integration.tests.js index 130f0f769f74..eae2d8691466 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.integration.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/focus.integration.tests.js @@ -4384,43 +4384,6 @@ QUnit.module('View\'s focus', { assert.equal(this.dataGrid.option('focusedRowKey'), 2, 'row key is changed'); assert.ok($(this.dataGrid.getRowElement(1)).hasClass('dx-row-focused'), 'second row is focused'); }); - - // T1224663 - ['onFocusedRowChanged', 'onFocusedRowChanging'].forEach(event => { - QUnit.testInActiveWindow(`Focus should be preserved on datagrid when rowsview repaints in ${event} event`, function(assert) { - // arrange - this.dataGrid.option({ - dataSource: [ - { id: 1, name: 'name 1' }, - { id: 2, name: 'name 2' }, - { id: 3, name: 'name 3' } - ], - keyExpr: 'id', - focusedRowEnabled: true, - [event]: (e) => { - this.dataGrid.repaint(); - } - }); - this.clock.tick(300); - - // act - $(this.dataGrid.getCellElement(0, 0)).trigger(CLICK_EVENT); - this.clock.tick(300); - - // assert - const firstRow = $(this.dataGrid.getRowElement(0)); - assert.ok(firstRow.hasClass('dx-row-focused'), 'first row is focused'); - - // act - const keyboard = keyboardMock(firstRow); - keyboard.keyDown('down'); - this.clock.tick(300); - - // assert - const secondRow = $(this.dataGrid.getRowElement(1)); - assert.ok(secondRow.hasClass('dx-row-focused'), 'second row is focused'); - }); - }); }); QUnit.module('API methods', baseModuleConfig, () => {