feat(ByRole): Allow filter by disabled state#1231
feat(ByRole): Allow filter by disabled state#1231eps1lon wants to merge 2 commits intotesting-library:mainfrom
Conversation
✅ Deploy Preview for testing-library ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
| <body> | ||
| <section> | ||
| <button disabled>Login</button> | ||
| <div role="alert" aria-disabled="false">Failed to login</button> |
There was a problem hiding this comment.
Having the aria-disabled here seems a bit confusing to me.
Are we also filtering by aria-disabled or just by the disabled attribute? I think that we should explain it here so people will have a clear understanding.
There was a problem hiding this comment.
We're filtering by things that are disabled according to the a11y tree. This applies to every filter option in ByRole.
This here includes examples.
How would you explain it do avoid confusions?
There was a problem hiding this comment.
I'm thinking about something like this maybe?
https://github.com/testing-library/testing-library-docs/pull/1231/files#r1148318567
| </body> | ||
| ``` | ||
|
|
||
| you can get the "Login" button by calling |
There was a problem hiding this comment.
| you can get the "Login" button by calling | |
| You can get the "Login" button by calling `getByRole('button', { disabled: true })` and the alert by calling `getByRole('alert', { disabled: false })`. |
Docs for testing-library/dom-testing-library#1221
Rendered preview