testing-library / testing-library/dom-testing-library
Collapse whitespace issue with
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 474
- PR merge metrics
- No merged PRs in 30d
Description
Had an issue that stemmed from Cypress testing library but debugged into Dom testing library. The issue is this function.
When searching for text with a non breaking space such as "٤ UK£", the regex replaces the nbsp into a space. It's fairly obvious why the regex was used, but it's effectively converting all types of spaces into a "regular space". This then causes the text match to fail.
In my opinion, that's an unintentional side effect of collapseWhitespace.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked function in src/matches.ts and inspect how collapseWhitespace handles the non-breaking space in the reported “٤ UK£” case. Done means matching text containing that space no longer fails as an unintended consequence of whitespace collapsing, with the behavior verified for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100