feat(debug): add a debug convenience method#87
Conversation
| "react/prop-types": "off", | ||
| "import/no-unassigned-import": "off" | ||
| "import/no-unassigned-import": "off", | ||
| "import/named": "off" |
There was a problem hiding this comment.
This is necessary because we're using export * from 'dom-testing-library' in the index.js and I don't think that eslint-plugin-import knows how to deal with that so it was erroring out when we imported things that come from dom-testing-library. Kinda annoying, but I'd rather use the export *, and I verified that it works for consumers of the library so we're good.
|
Wow, this was quick! Any help needed? |
Codecov Report
@@ Coverage Diff @@
## master #87 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 16 17 +1
=====================================
+ Hits 16 17 +1
Continue to review full report at Codecov.
|
|
Thanks @Gpx. Nope. Sorry, normally I would have let you work on this, but I needed to code this for my own well being (I was feeling very demotivated to do any work yesterday, this was a task I could do and feel accomplished). Thanks! |
|
🎉 This PR is included in version 3.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
Hoped it helped. It's definitely going to be useful to me 🎉 |
…rary#87) **What**: Changes the way `getNodeText` joins nodes. Instead of joining them with a space, it now joins them with an empty string. <!-- Why are these changes necessary? --> **Why**: This PR comes out of testing-library#53 In React, if you have an element like `<span>{volts}V</span>`, then the generated element will have two text nodes, one for the variable `volts`, and one for the normal string. When browsers render this, there is no space between the text nodes. Likewise, the `textContent` property on the span will return a string without spaces (e.g. `300V`). However, the current implementation of `getNodeText` joins all of the nodes with a space, so if you try to use e.g. `queryByText('300V')` it will return `null`. For a live demo, see https://codesandbox.io/s/w718n5ojq7 <!-- How were these changes implemented? --> **How**: - changing `join(' ')` to `join('')` on [line 8 of `src/get-node-text.js`](https://github.com/kentcdodds/dom-testing-library/compare/master...bdchauvette:pr/get-node-text-whitespace?expand=1#diff-6350d468f7684d134aab9d42d96a77beR8) - adding [a test](https://github.com/kentcdodds/dom-testing-library/compare/master...bdchauvette:pr/get-node-text-whitespace?expand=1#diff-de31c4d0bed96b2a4211de164bb1b589R59) for querying against a DOM element containing adjacent text nodes without any whitespace <!-- Have you done all of these things? --> **Checklist**: <!-- add "N/A" to the end of each line that's irrelevant to your changes --> <!-- to check an item, place an "x" in the box like so: "- [x] Documentation" --> - [ ] Documentation - **N/A** (I think?) - [x] Tests - [x] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? --> - [x] Added myself to contributors table <!-- this is optional, see the contributing guidelines for instructions --> <!-- feel free to add additional comments --> Thanks! 😸 Closes testing-library#53
What: add a debug convenience method
Also add @Gpx to contributors!
Why:
Closes #86
How:
debugmethod to make it really easy to log the container.Checklist: