-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Update site's doc mockComponent() #106
Conversation
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 cla@fb.com. Thanks! |
Deploy preview ready! Built with commit b6e2f24 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
content/docs/addons-test-utils.md
Outdated
@@ -112,6 +112,10 @@ mockComponent( | |||
|
|||
Pass a mocked component module to this method to augment it with useful methods that allow it to be used as a dummy React component. Instead of rendering as usual, the component will become a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children. | |||
|
|||
> Note: | |||
> | |||
> `mockComponent()` is a legacy method that is no longer needed. A similar pattern can be implemented directly. |
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.
How do you feel about the following alternative wording?
`mockComponent()` is a legacy API. We recommend using [shallow rendering](/docs/test-utils.html#shallow-rendering) instead.
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.
shallow rendering or jest.mock()
if you use Jest.
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.
Nice! I like that there's recommendations in this alternate wording -- added a commit :)
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.
I dig it. Thanks for the quick responses!
* Translated unknown-prop page. * Translate community-tools comp-workbenchs. * Translate community-tools debuggins. * Translate tools/jsx-integrations. * Translate tools/starter-kits. * Translate community/tools-routing. * Translate community/tools-model-mgmt. * Translate community/data-fetching.html * Translate community/tools-testing. * Translate community/tools-ui-components. * Translate community/tools-misc. * Update content/community/tools-comp-workbenches.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-data-fetching.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-data-fetching.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-jsx.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-jsx.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-starter-kits.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-starter-kits.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-starter-kits.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-testing.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-jsx.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update content/community/tools-jsx.md Co-Authored-By: crisgon <kristiano.gon@gmail.com> * Update tools-testing.md
Issue #84 Happy Thanksgiving! 🦃
Not sure if I was supposed to include that it is preferred to use shallow rendering but I added that mockComponent() is now legacy, unnecessary, and a similar pattern can be implemented directly if user wishes to do so.
Please review and let me know if I'm missing anything 💃