Skip to content

Commit

Permalink
DataGrid - Hovering does not highlight rows properly (T1240074) (DevE…
Browse files Browse the repository at this point in the history
  • Loading branch information
tongsonbarbs authored Jul 15, 2024
1 parent 982742c commit d9f2762
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import DataGrid from 'devextreme-testcafe-models/dataGrid';
import { createWidget } from '../../../helpers/createWidget';
import url from '../../../helpers/getPageUrl';
import { getData } from '../helpers/generateDataSourceData';

fixture.disablePageReloads`HoveringRows`.page(
url(__dirname, '../../container.html'),
);

test('Hover over rows in the middle', async (t) => {
const dataGrid = new DataGrid('#container');
const firstRow = dataGrid.getDataRow(10);
const secondRow = dataGrid.getDataRow(11);

await t.hover(firstRow.element)
.expect(firstRow.isHovered)
.ok();

await t.hover(secondRow.element)
.expect(firstRow.isHovered)
.notOk()
.expect(secondRow.isHovered)
.ok();
}).before(async () => {
await createWidget(
'dxDataGrid',
{
dataSource: getData(20, 3),
hoverStateEnabled: true,
},
);
});

test('Hover over first and last rows', async (t) => {
const dataGrid = new DataGrid('#container');
const firstRow = dataGrid.getDataRow(0);
const lastRow = dataGrid.getDataRow(19);

await t.hover(firstRow.element)
.expect(firstRow.isHovered)
.ok();

await t.hover(lastRow.element)
.expect(firstRow.isHovered)
.notOk()
.expect(lastRow.isHovered)
.ok();
}).before(async () => {
await createWidget(
'dxDataGrid',
{
dataSource: getData(20, 3),
hoverStateEnabled: true,
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,9 @@ class DataGrid extends GridCoreWidget<Properties> {
]);
}

private _init() {
protected _init() {
const that = this;

// @ts-expect-error
super._init();

gridCoreUtils.logHeaderFilterDeprecatedWarningIfNeed(that);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Widget from '@js/ui/widget/ui.widget';
const GRID_CORE_ROW_SELECTOR = '.dx-row';

export default class GridCoreWidget<TProperties> extends Widget<TProperties> {
private readonly _activeStateUnit = GRID_CORE_ROW_SELECTOR;
private _activeStateUnit;

private readonly _controllers: any;

Expand All @@ -26,6 +26,12 @@ export default class GridCoreWidget<TProperties> extends Widget<TProperties> {
return result;
}

protected _init() {
this._activeStateUnit = GRID_CORE_ROW_SELECTOR;
// @ts-expect-error
super._init();
}

protected _setDeprecatedOptions() {
// @ts-expect-error
super._setDeprecatedOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class TreeList extends GridCoreWidget<dxTreeListOptions> {
protected _init() {
const that = this;

// @ts-expect-error
super._init();

if (!this.option('_disableDeprecationWarnings')) {
Expand Down

0 comments on commit d9f2762

Please sign in to comment.