-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Make snapshots more HTML friendly #9091
Comments
This brings back a memory, so I must have edited some snapshots to view as HTML too :) If the situation is once-in-while for you like is was for me, then an editing script might give you a favorable return on investment. What do you think? Here is a facebook/react#13525 (comment) that discusses at length whether React might ever replace By the way, snapshots of DOM elements created outside React in tests with
|
thanks for your comments :) I think changing "className" to "class" is less of an issue for me, because it is still runnable HTML. |
@oliverwatkins Something came to mind that might be relevant to you. To create SVG diagrams from code, I used ReactDOMServer.renderToStaticMarkup If your tests create React elements (in contrast to React Test Renderer objects) then a quick and dirty technique to explore is temporarily edit a passing test to also write the static markup to an external file, run the test, and then undo your change to the test file. |
yes thankyou. the renderToSaticMarkup would be a good idea to get the HTML. cheers |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
Make snapshots more HTML friendly
Motivation
If I want to view a snapshot as a HTML document I have to remove javascript {Object} from style
attributes, and 'Function' objects from callbacks.
Example
Some examples :
and..
Pitch
Mostly it is not a big deal removing these [Function]s and {Object}s but if it is a really big snapshot file it becomes incredibly tedious. Maybe just surround this code with quotation marks so that is runnable as HTML. And would it not be too hard to replace the className with class?
The text was updated successfully, but these errors were encountered: