Skip to content
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import DataGrid from 'devextreme-testcafe-models/dataGrid';
import List from 'devextreme-testcafe-models/list';
import url from '../../../../helpers/getPageUrl';
import { createWidget } from '../../../../helpers/createWidget';
import { testScreenshot } from '../../../../helpers/themeUtils';
Expand All @@ -8,6 +9,58 @@ fixture.disablePageReloads`No Data`
.page(url(__dirname, '../../../container.html'));

const GRID_CONTAINER = '#container';
const OVERLAY_SELECTOR = '.dx-overlay-wrapper';

test('The noDataText element should be rendered when a lookup column is filtered (T1293839)', async (t) => {
// arrange
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dataGrid = new DataGrid(GRID_CONTAINER);
const filterRow = dataGrid.getHeaders().getFilterRow();
const nameFilterCell = filterRow.getFilterCell(0);
const nameFilterEditor = nameFilterCell.getEditorInput();
const lookupFilterCell = filterRow.getFilterCell(1);

// act
await t.click(lookupFilterCell.element);
const lookupList = new List(OVERLAY_SELECTOR);
Comment on lines +17 to +25
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test interacts with the filter row immediately after creating the widget, but doesn’t assert the grid is ready first. Please add an await t.expect(dataGrid.isReady()).ok(); (or equivalent) before clicking/typing to avoid timing-related failures on slower CI runs.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, it is recommended to add this check since data is always loaded asynchronously (by default, within 30ms). Failure to do so may result in flickering tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment: I suggest creating a getLookup/getSelectBox method at the FilterCell model level, which will return the SelectBox model. This model has the necessary API for testing.

const lookupItem = lookupList.getItem(1);
await t.click(lookupItem.element);
await t.typeText(nameFilterEditor.element, 'test');

// assert
await t
.expect(dataGrid.isReady())
.ok();

await testScreenshot(t, takeScreenshot, 'T1293839-grid-no-data-text-rendered.png', { element: dataGrid.element });
await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => {
await createWidget('dxDataGrid', {
dataSource: [
{ ID: 1, Name: 'John', Lookup: 1 },
{ ID: 2, Name: 'Jane', Lookup: 2 },
],
keyExpr: 'ID',
columns: ['Name', {
dataField: 'Lookup',
lookup: {
dataSource: [
{ ID: 1, Text: 'Item 1' },
{ ID: 2, Text: 'Item 2' },
],
valueExpr: 'ID',
displayExpr: 'Text',
},
}],
showBorders: true,
filterRow: { visible: true },
onEditorPreparing(e) {
e.updateValueTimeout = 0;
},
});
});

test('The noDataText element should be centered (T1178289)', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ export class DataController extends DataHelperMixin(modules.Controller) {
}

public isCustomLoading() {
return this._isCustomLoading;
return this._isCustomLoading || this._dataSource?.isCustomLoading();
}

public beginCustomLoading(messageText?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default {
const noDataClass = that.addWidgetPrefix(NO_DATA_CLASS);
let noDataElement = $element.find(`.${noDataClass}`).last();
const isVisible = this._dataController.isEmpty();
const isLoading = this._dataController.isLoading();
const isDefaultLoading = this._dataController.isLoading() && !this._dataController.isCustomLoading?.();

if (!noDataElement.length) {
noDataElement = $('<span>')
Expand All @@ -223,7 +223,7 @@ export default {
noDataElement.appendTo($element);
}

if (isVisible && !isLoading) {
if (isVisible && !isDefaultLoading) {
noDataElement
.removeClass('dx-hidden')
.text(that._getNoDataText());
Expand Down
Loading