Skip to content

Commit

Permalink
T1187314 - DataGrid displays an incorrect row count in "aria-label" i…
Browse files Browse the repository at this point in the history
…f there is no data after filtering (#25551)

Co-authored-by: Andrey Dolzhikov <[email protected]>
  • Loading branch information
Raushen and Andrey Dolzhikov authored Sep 8, 2023
1 parent a26c663 commit d12012e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ const resizingControllerMembers = {
},

_setAriaLabel() {
const totalItemsCount = Math.max(0, this._dataController.totalItemsCount());
this.component.setAria('label', messageLocalization.format(
this._getWidgetAriaLabel(),
// @ts-expect-error
this._dataController.totalItemsCount(),
totalItemsCount,
this.component.columnCount(),
), this.component.$element().children(`.${GRIDBASE_CONTAINER_CLASS}`));
},
Expand Down
4 changes: 4 additions & 0 deletions packages/devextreme/testing/testcafe/model/dataGrid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export default class DataGrid extends Widget {
return Widget.addClassPrefix(this.getName(), className);
}

getContainer(): Selector {
return this.element.find(`.${CLASS.dataGrid}`);
}

getHeaders(): Headers {
return new Headers(this.element.find(`.${this.addWidgetPrefix(CLASS.headers)}`), this.getName());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import createWidget from '../../../helpers/createWidget';
import url from '../../../helpers/getPageUrl';
import DataGrid from '../../../model/dataGrid';

fixture`Accessibility bugs`
.page(url(__dirname, '../../container.html'));

test('T1187314 - DataGrid displays an incorrect row count in "aria-label" if there is no data after filtering', async (t) => {
const dataGrid = new DataGrid('#container');

await t
.expect(dataGrid.getContainer().getAttribute('aria-label'))
.eql('Data grid with 0 rows and 2 columns');
}).before(async () => createWidget('dxDataGrid', {
keyExpr: 'id',
dataSource: [{
id: 0,
data: 'A',
}],
filterRow: { visible: true },
filterValue: ['id', '=', '1'],
scrolling: { mode: 'infinite' },
}));

0 comments on commit d12012e

Please sign in to comment.