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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update site's doc mockComponent() #106

Merged
merged 3 commits into from
Oct 10, 2017

Conversation

annuhdo
Copy link
Contributor

@annuhdo annuhdo commented Oct 9, 2017

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 馃拑

image

@facebook-github-bot
Copy link
Collaborator

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!

@reactjs-bot
Copy link

reactjs-bot commented Oct 9, 2017

Deploy preview ready!

Built with commit b6e2f24

https://deploy-preview-106--reactjs.netlify.com

@facebook-github-bot
Copy link
Collaborator

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

@annuhdo annuhdo changed the title Update doc mock component Update site's doc mockComponent() Oct 10, 2017
@@ -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.
Copy link
Contributor

@bvaughn bvaughn Oct 10, 2017

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.

Copy link
Member

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.

Copy link
Contributor Author

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 :)

Copy link
Contributor

@bvaughn bvaughn left a 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!

@bvaughn bvaughn merged commit 877da53 into reactjs:master Oct 10, 2017
@annuhdo annuhdo deleted the update-doc-mockComponent branch October 10, 2017 17:54
jhonmike pushed a commit to jhonmike/reactjs.org that referenced this pull request Jul 1, 2020
* 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
BetterZxx pushed a commit to BetterZxx/react.dev that referenced this pull request Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants