mbrn / material-table

Datatable for React based on material-ui's table with additional features

Home Page:https://material-table.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FR: Ability to give the table a name

cjsilva-umich opened this issue · comments

Is your feature request related to a problem? Please describe.
I would like to be able to pass a name to the base <table> element for testing purposes. If the table appears conditionally (ie: my app may show an error message instead of the table if there's a network error or similar) it would be nice to be able to do a simple const materialTable = await screen.findByRole("table", { name: "my-cool-table" })
using react-testing-library/jest.

Currently, my only choice seems to be to check whether the string I pass for the title is there as the appropriate heading level:
const tableHeading = await screen.findByRole("heading", { level: 6, name: "My Cool Table" })

Would much prefer the former. Is there any way to assign that table name?

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.