Skip to content

JSS style blocks overwhelm prettyDOM / debug output #81

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

Closed
timbonicus opened this issue Jul 24, 2018 · 4 comments
Closed

JSS style blocks overwhelm prettyDOM / debug output #81

timbonicus opened this issue Jul 24, 2018 · 4 comments

Comments

@timbonicus
Copy link

Describe the feature you'd like:

The automatic debug output / prettyDOM is hard to pick through with JSS, since a rather large style block is added to the DOM with JSS classes. There should be a way to avoid JSS output (the material-ui library in our case dumps out 10,000 lines of CSS, which is thought-provoking in itself, but here we are).

Suggested implementation:

I was thinking of an option to prune style blocks from the output; @kentcdodds suggested that defaulting the debug output to the container instead of the documentElement might be a better idea.

@kentcdodds
Copy link
Member

Thinking about it more, what if we use document.body? That would avoid this issue without making it harder/confusing for portals.

@timbonicus
Copy link
Author

That would work well for my purposes; the JSS style blocks are in the document head. I know browsers are lenient with <style> in document.body, but I'm not sure that's worth worrying about.

@kentcdodds
Copy link
Member

Hmmm... I actually think this change will need to be in react-testing-library because the way it works right now is it'll log out everything in the container that's the basis for the queries and in react-testing-library that's set to the documentElement. I think the best solution would probably be to just change that to document.body. I don't think anyone puts portals anywhere other than the document.body so we should be safe to make that change here.

Would you like to do that?

@timbonicus
Copy link
Author

timbonicus commented Jul 25, 2018

Thanks @kentcdodds! Submitted a react-testing-lib PR.

alexkrolick pushed a commit to alexkrolick/dom-testing-library that referenced this issue Sep 13, 2018
* Switch default baseElement to document.body; fixes dom-testing-library testing-library#81.

* add contributor to readme

Closes testing-library#81
xbucks pushed a commit to xbucks/tauri-crypto-trading that referenced this issue Oct 15, 2023
* Switch default baseElement to document.body; fixes dom-testing-library #81.

* add contributor to readme

Closes testing-library/dom-testing-library#81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants