Refactor toJSON#42828
Closed
jackpope wants to merge 3 commits into
Closed
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D53321821 |
added 3 commits
February 2, 2024 13:22
Summary: This is a simple snapshot test using ReactTestRender's toJSON. We have almost the same functionality in RNTR already, so let's see if we can support tests like this. Merging the new setup and environment with the existing configuration (https://fburl.com/code/s85sma77) still causes issues so here we add unmocking and new setup inline. Added task T177114228 to track following up on this Note that some formatting is changed and props are dropped on the snapshot. This is resolved with refactor in next diff Changelog: [internal] Reviewed By: yungsters Differential Revision: D53321823
Summary: Updates to toJSON: - return object tree instead of formatted snapshot string. Applying the `'react.test.json'` symbol lets Jest do the formatting work for us - Source props from `pendingProps` on `instanceHandle`. This adds props such as `pointerEvents` and `style` which were present on RTR's snapshots but don't get included in the node's `props` collection - Render text node as text value, instead of RCTRawText like `<RCTRawText text="Hello" />` Changelog: [internal] Reviewed By: kassens Differential Revision: D53321821
01a1cd8 to
24c324f
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D53321821 |
Base commit: af8c82d |
Contributor
|
This pull request has been merged in 41045a1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Updates to toJSON:
'react.test.json'symbol lets Jest do the formatting work for uspendingPropsoninstanceHandle. This adds props such aspointerEventsandstylewhich were present on RTR's snapshots but don't get included in the node'spropscollection<RCTRawText text="Hello" />Reviewed By: kassens
Differential Revision: D53321821
Changelog: [internal]