-
Notifications
You must be signed in to change notification settings - Fork 470
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
fix: not similar behaviour of ByLabelText and ByRole queries with nbsp in DOM (fix #890, #904) #946
fix: not similar behaviour of ByLabelText and ByRole queries with nbsp in DOM (fix #890, #904) #946
Conversation
…and `ByRole` queries - first step to fix testing-library#904 - not similar behaviour of `ByLabelText` and `ByRole, {name: ''}` with nbsp at DOM
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 36faca6:
|
…queries in we have nbsp - by adding to byRole the same Normalizer we are using at ByLabelText
@@ -153,7 +153,7 @@ function queryAllByRole( | |||
}), | |||
element, | |||
name, | |||
text => text, | |||
matchNormalizer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What else does matchNormalizer
do? If you just want to fix nbsp
then we should make this explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to request at issue matchNormalizer
- here sync behavior for ByLabelText
and ByRole
.
the idea that we'll have the same behavior/results for the same inputs.
Codecov Report
@@ Coverage Diff @@
## main #946 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 26
Lines 966 965 -1
Branches 293 293
=========================================
- Hits 966 965 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
See #904 (comment) |
According to the fix #904 issue - getByRole fails if filtering by accessible name with in it
Probably this PR also can fix #890
If we have at label name then
ByLabelText('text with nbsp') and ByRole('textbox', {name: 'text with nbsp'}) queries behave differently
This PR will solve an issue by sync behavior.
Currently, as the first step of solutions representing tests showing different behavior are added.
Checklist:
docs site