Skip to content
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

adds createTestInstance function to ReactTestRenderer #12944

Conversation

petegleeson
Copy link

Hello, I have had a crack at solving #12753. This change gives people the ability to traverse a component tree rendered by ReactDOM in a sanctioned way. Having a public API that provides this ability will be useful for testing libraries like Enzyme.

This is the most straight forward approach I could come up with. Would love opinions on whether this is the right package to expose this functionality.

Some todos:

  • Documentation
  • A more realistic test that uses ReactDOM

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@pull-bot
Copy link

Details of bundled changes.

Comparing: 79a740c...7125628

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.1% 340.4 KB 340.75 KB 73.61 KB 73.69 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.3% 🔺+0.2% 45.81 KB 45.93 KB 14.19 KB 14.22 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.1% 331.23 KB 331.58 KB 70.87 KB 70.96 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.3% 🔺+0.2% 44.91 KB 45.03 KB 13.74 KB 13.76 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% +0.1% 337.13 KB 337.52 KB 70.46 KB 70.55 KB FB_WWW_DEV

Generated by 🚫 dangerJS

@petegleeson
Copy link
Author

Something to note - the implementation of this function assumes that wrapped node was created by TestRenderer. Not sure if this will cause problems when ReactTestInstance wraps nodes rendered by ReactDOM.

@stale
Copy link

stale bot commented Jan 10, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jan 10, 2020
@stale
Copy link

stale bot commented Jan 17, 2020

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

@stale stale bot closed this Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants