-
Notifications
You must be signed in to change notification settings - Fork 470
Ignore extra whitespace in node texts #21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ignore extra whitespace in node texts #21
Conversation
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.
Almost everything looks great!
src/queries.js
Outdated
@@ -173,6 +171,7 @@ export { | |||
queryByPlaceholderText, | |||
getByPlaceholderText, | |||
queryByText, | |||
getText, |
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.
This file should only expose queries. Other utilities should live in other files. Could you move getText
to its own file?
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.
Got it. Also, I wonder if we should publicly call it getNodeText
instead?
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.
Agreed. We can rename it to getNodeText
👍
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.
Super duper. Thanks!
README.md
Outdated
// Hello | ||
// World ! | ||
// </div> | ||
const text = getNodeText(container.querySelector('div')) // "Hello World!" |
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.
Shouldn't this be: "Hello World !" ?
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.
Yup, good catch!
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.
Hmmm... Looks like these changes broke a test 🤔
This looks unrelated, and perhaps there's a brittle test in the wait-for-element part. I just ran |
BTW (unrelated but) have you considered adding |
I've restarted the build. Yes, that's odd. Hmmm...
I have not! Hmmm... I wonder if I could make it interactive. If there are snapshot differences, ask the user if they'd like to cancel the commit or update them... Not sure that'd be possible with lint-staged though... |
The restarted build passed! 😱 |
Uh oh... We should probably look into that. |
* added waitForExpect with test * added typescript and simplified version of the waitForExpect, used and exports its typings * added initial notes about waitForExpect * fixed styling * minor stylistic change * updated tests to remove the nesting * updated readme * fixed d .md syntax * improved style Closes testing-library#21
As discussed in testing-library/jest-dom#9 (comment)