Skip to content

Commit f15e7d6

Browse files
authored
feat(AnalyticalTable): add cellLabel column option (#5512)
1 parent bb65f33 commit f15e7d6

File tree

5 files changed

+71
-34
lines changed

5 files changed

+71
-34
lines changed

packages/main/src/components/AnalyticalTable/AnalyticalTable.cy.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,8 +1922,14 @@ describe('AnalyticalTable', () => {
19221922
cy.findByText('Selected: {"0":true,"1":true,"2":true,"3":true}').should('be.visible');
19231923
});
19241924

1925-
it('a11y: grouped, filtered, sorted, headerLabel', () => {
1926-
cy.mount(<AnalyticalTable columns={columns} data={data} groupable filterable sortable />);
1925+
it('a11y: grouped, filtered, sorted, headerLabel, cellLabel', () => {
1926+
const customCellColumn = {
1927+
Header: 'Custom',
1928+
id: 'custom',
1929+
Cell: () => 'Custom Content',
1930+
cellLabel: ({ cell }) => `${cell.cellLabel} custom aria-label`
1931+
};
1932+
cy.mount(<AnalyticalTable columns={[...columns, customCellColumn]} data={data} groupable filterable sortable />);
19271933
cy.findByText('Name').click();
19281934
cy.findByText('Sort Ascending').shadow().findByRole('listitem').click({ force: true });
19291935
cy.get('[data-column-id="name"]').should('have.attr', 'aria-sort', 'ascending');
@@ -1973,6 +1979,11 @@ describe('AnalyticalTable', () => {
19731979
'aria-label',
19741980
'Custom Label '
19751981
);
1982+
cy.get('[data-visible-row-index="1"][data-visible-column-index="4"]').should(
1983+
'have.attr',
1984+
'aria-label',
1985+
'Custom custom aria-label'
1986+
);
19761987
});
19771988

19781989
it("Expandable: don't scroll when expanded/collapsed", () => {

0 commit comments

Comments
 (0)