-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support buttons with checkbox role for 'toBeRequired' #481
Comments
I've run into this issue as well using shadcn which is essentially using radix components. Any updates on this one? It would be good to support this. For now, as a workaround, I used // eslint-disable-next-line jest-dom/prefer-required
expect(checkbox).toHaveAttribute('aria-required', 'true'); |
This is a valid issue. It seems that jest-dom does not implement this part of what's documented in MDN:
|
Hey @gnapse, I would like to fix this issue. I just wanted to confirm whether adding a new function in to-be-required file that checks if the element has PS: This is going to be my first contribution to this repo. So, any help would be appreciated :) |
Sounds good. As long as it does not impact the outer interface, of course that internally inside the module you can add helper functions, etc.
Documentation, maybe. We should consider mentioning in the README the new functionality, under the section related to the
Sure. Give it a go with a PR and we'll take it from there. Feel free to request my review directly. Looking forward to your first contribution. Thanks for taking the time to do it! |
Describe the feature you'd like:
Hi,
I'm using Radix checkboxes https://www.radix-ui.com/docs/primitives/components/checkbox#root, it renders a button with
role="checkbox"
and supports required by addingaria-required="true"
but I can't test it because in here https://github.com/testing-library/jest-dom/blob/main/src/to-be-required.js#L6 does not include either button as a valid form tag or checkbox as a valid role.Not sure if this would be a bug or just a feature requirement
Suggested implementation:
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
The text was updated successfully, but these errors were encountered: