-
Notifications
You must be signed in to change notification settings - Fork 272
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
feature: implement toHaveAccessibleName
Jest matcher
#1503
Comments
I can do this! |
@anishamalde pls go ahead! |
@mdjastrzebski just double checking this is correct:
|
Yes it's correct signature |
I have completed the implementation with the exception of it getting labelled by the text content of nested element referenced by accessibilityLabelledBy / aria-labelledby prop. I tried the |
@anishamalde you should be able to reuse parts of |
Just seen the function, thank-you, will update the PR! |
Resolved by #1509 |
🎉 Release in version: v12.4.0 |
Describe the Feature
toHaveAccessibleName
is a Jest DOM matcher asserting that given element has certain accessible name: text content or a11y label.RNTL already contains some code working with accessible name, namely
*ByRole
query accepts an optionalname
param. This matcher should compare expect name parameter with all of these:accessibilityLabelledBy
/aria-labelledby
propaccessbilityLabel
/aria-label
propThese should be evaluated in that particular order.
Possible Implementations
Proposed API:
The matcher should:
expectedName
param is provided check if it matches element's accessible nameexpectedName
is not provided check if element has accessible nameEach matcher should have a fairly comprehensive test suite.
Related Issues
#1454
The text was updated successfully, but these errors were encountered: