-
Notifications
You must be signed in to change notification settings - Fork 472
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
feat(logDOM): add logDOM export #336
Conversation
Actually, it looks like |
Codecov Report
@@ Coverage Diff @@
## master #336 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 21 21
Lines 311 315 +4
Branches 66 66
=====================================
+ Hits 311 315 +4
Continue to review full report at Codecov.
|
43b3cc1
to
4597576
Compare
if (htmlElement.documentElement) { | ||
htmlElement = htmlElement.documentElement | ||
function prettyDOM( | ||
dom = getDocument().body, |
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.
If someone's not running in an environment where the document is globally available, then they have to provide a DOM node to log, otherwise we'll just default to document.body
which I think is a good default. I imagine lots of people will just call logDOM()
and that'll be helpful to them!
ba3ef0f
to
56a5a16
Compare
Dang it. I just realized that we did export So here's what I'm thinking. Let's call this a breaking change (because it technically is) and we'll release this one with the RTL change here: testing-library/react-testing-library#430 Thoughts? |
56a5a16
to
430d449
Compare
@@ -20,7 +20,7 @@ export type AllByAttribute = ( | |||
|
|||
export const queryByAttribute: QueryByAttribute | |||
export const queryAllByAttribute: AllByAttribute | |||
export const debugDOM: (htmlElement: HTMLElement) => string | |||
export const logDOM: (htmlElement: HTMLElement) => void |
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 is the breaking change.
Impact is minimal because people probably aren't relying on this for their actual tests and it's more of a workflow method (which I doubt many people use).
That said, some libraries built on top of DTL may use this method, and the upgrade strategy for them is to switch from debugDOM
to prettyDOM
.
430d449
to
27c9ddd
Compare
27c9ddd
to
1d2d56b
Compare
There was an issue with a major release, so this manual-releases.md change is to release a new major version. Reference: #336 BREAKING CHANGE: If you were using `debugDOM` before, use `prettyDOM` instead.
🎉 This PR is included in version 6.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What: add
logDOM
exportWhy: I was working on #314, but I misunderstood it and changed gears. But I liked the refactor I was working on it.
How: Moved some logic around and now pretty-dom is responsible for determining default values for limit and options. I think it's a bit cleaner this way.
This is a breaking change because it basically moves
debugDOM
logic toprettyDOM
.debugDOM
was pretty useless after this change, so it's been removed.It also adds an export for a new
logDOM
which does what it says.Checklist:
docs site N/A