-
Notifications
You must be signed in to change notification settings - Fork 44
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: toHaveTextContent collect properly text of children nodes #61
fix: toHaveTextContent collect properly text of children nodes #61
Conversation
Oh yay! Using the code in the PR solves an issue I've been having. It'd be great if we could have this merged in, assuming it doesn't present too many flaws by digging 'n' levels deep. |
@brunohkbx @thymikee aside from conflicts, thoughts on this PR? |
Conflicts solved :D |
Hey |
Codecov Report
@@ Coverage Diff @@
## main #61 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 8 8
Lines 149 143 -6
Branches 50 44 -6
=========================================
- Hits 149 143 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
🎉 This PR is included in version 4.0.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
I've fixed #60 but this also cover the fixes from #59 (I've also copied the PR author test... but if the author wishes to merge his changes first and then have me apply my changes and rewrite this PR I can do it)
I've also added a missing test to assure that
toHaveTextContent
fails when it shouldWhy:
Described in #60, but to summarize:
toHaveTextContent
wasn't collecting properly children nodes to find textHow:
I've made a simple recursive function that transverses all children collecting text childs and join them for the match comparison
Checklist:
import {target} from 'ramda'
toimport target from 'ramda/es/{target}'
), this would speed up things a little for jest/babel as it would not need to bundle/collect a lot of unused ramda functions from the ramda index.js