-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Add 'Test Utils' docs back to main navigation #9676
Conversation
docs/_data/nav_docs.yml
Outdated
@@ -32,6 +32,8 @@ | |||
title: JSX In Depth | |||
- id: typechecking-with-proptypes | |||
title: Typechecking With PropTypes | |||
- id: test-utils | |||
title: Test Utilities |
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.
This is a reference so it should probably go in the "reference" rather than "advanced guides". Guides read like prose, reference is more like a dictionary.
Can be last item there, after synthetic events.
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.
Sounds good!
docs/docs/addons-test-utils.md
Outdated
@@ -2,8 +2,6 @@ | |||
id: test-utils | |||
title: Test Utilities | |||
permalink: docs/test-utils.html | |||
layout: docs | |||
category: Reference |
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.
It should be in the reference so the old category looks correct.
35b54c9
to
aa5b0eb
Compare
Going to add to this in order to correct the outdated 'shallow renderer' docs. |
Sorry I left this so long - hopefully it's an easy review now. |
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.
Accepting with nits:
- Let's move "shallow rendering" subsection to the top of "test utilities" page
- "Shallow rendering" page could use an intro sentence about it being used for testing, since "shallow" isn't really descriptive to people who look at it for the first time.
- Let's say "documentation" rather than "documents".
- The shallow rendering doc ends with a weird horizontal line—can we remove it?
docs/docs/addons-test-utils.md
Outdated
@@ -252,32 +252,5 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu | |||
|
|||
## Shallow Rendering |
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.
Can we move this section right after Overview? It's what most people are looking for when testing React.
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.
Sounds good~ will fix
docs/docs/addons-test-utils.md
Outdated
|
||
After [`shallowRenderer.render()`](#shallowrenderer.render) has been called, returns shallowly rendered output. | ||
> Note: | ||
> The shallow renderer has moved to `react-test-renderer/shallow`. [Please see the updated documents.](/react/docs/shallow-renderer.html) |
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.
Maybe "updated documentation".
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.
will fix
**why make this change?:** We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs. **test plan:** Manually tested the website - will insert a screenshot. **issue:** facebook#9651
**what is the change?:** Moved from 'advanced guides' to 'reference' **why make this change?:** It makes more sense as a reference **test plan:** Visual inspection (flarnie may add a screenshot) **issue:**
**what is the change?:** - Remove outdated 'shallow renderer' docs on 'test utils' page, and point to the updated 'shallow renderer' docs. - Re-add a link to the updated 'shallow renderer' docs on the main navigation. **why make this change?:** This was already approved in facebook#9331 which was then cherry-picked to https://github.com/facebook/react/pull/9359/commits and landed on master. I'm not sure why some of these changes didn't persist. For now just adding back the changes we need. **test plan:** Manually inspected website - will insert screenshots. **issue:**
Thanks @gaearon for the improvements! **what is the change?:** - Remove <hr/> from end of 'shallow rendering' docs - 'documents' -> 'documentation' - Move 'shallow rendering' redirection section to top of 'test utils' docs - Add intro sentence about testing to 'shallow rendering' docs **why make this change?:** Documentation helps people learn. **test plan:** Visual inspection
567a40a
to
06947b1
Compare
@flarnie Please add "documentation: needs merge to stable" to merged doc PRs. Otherwise they won't get into the doc site until next major. |
@@ -14,7 +14,7 @@ var ReactShallowRenderer = require('react-test-renderer/shallow'); // ES5 with n | |||
``` | |||
### Shallow Rendering | |||
|
|||
Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM. | |||
When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM. | |||
|
|||
- [`shallowRenderer.render()`](#shallowrenderer.render) |
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.
Just noticed these links don’t go anywhere. I wonder why we have them.
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.
Not sure - just saw that you cleaned it up along with other things. Thanks!
* Add 'Test Utils' docs back to main navigation **why make this change?:** We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs. **test plan:** Manually tested the website - will insert a screenshot. **issue:** #9651 * Move test-utils docs to reference section **what is the change?:** Moved from 'advanced guides' to 'reference' **why make this change?:** It makes more sense as a reference **test plan:** Visual inspection (flarnie may add a screenshot) **issue:** * Add back the shallow renderer docs and remove outdated docs **what is the change?:** - Remove outdated 'shallow renderer' docs on 'test utils' page, and point to the updated 'shallow renderer' docs. - Re-add a link to the updated 'shallow renderer' docs on the main navigation. **why make this change?:** This was already approved in #9331 which was then cherry-picked to https://github.com/facebook/react/pull/9359/commits and landed on master. I'm not sure why some of these changes didn't persist. For now just adding back the changes we need. **test plan:** Manually inspected website - will insert screenshots. **issue:** * Further improvements to 'shallow rendering' and 'test utils' docs Thanks @gaearon for the improvements! **what is the change?:** - Remove <hr/> from end of 'shallow rendering' docs - 'documents' -> 'documentation' - Move 'shallow rendering' redirection section to top of 'test utils' docs - Add intro sentence about testing to 'shallow rendering' docs **why make this change?:** Documentation helps people learn. **test plan:** Visual inspection (cherry picked from commit 114b9c5)
* Add 'Test Utils' docs back to main navigation **why make this change?:** We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs. **test plan:** Manually tested the website - will insert a screenshot. **issue:** #9651 * Move test-utils docs to reference section **what is the change?:** Moved from 'advanced guides' to 'reference' **why make this change?:** It makes more sense as a reference **test plan:** Visual inspection (flarnie may add a screenshot) **issue:** * Add back the shallow renderer docs and remove outdated docs **what is the change?:** - Remove outdated 'shallow renderer' docs on 'test utils' page, and point to the updated 'shallow renderer' docs. - Re-add a link to the updated 'shallow renderer' docs on the main navigation. **why make this change?:** This was already approved in #9331 which was then cherry-picked to https://github.com/facebook/react/pull/9359/commits and landed on master. I'm not sure why some of these changes didn't persist. For now just adding back the changes we need. **test plan:** Manually inspected website - will insert screenshots. **issue:** * Further improvements to 'shallow rendering' and 'test utils' docs Thanks @gaearon for the improvements! **what is the change?:** - Remove <hr/> from end of 'shallow rendering' docs - 'documents' -> 'documentation' - Move 'shallow rendering' redirection section to top of 'test utils' docs - Add intro sentence about testing to 'shallow rendering' docs **why make this change?:** Documentation helps people learn. **test plan:** Visual inspection (cherry picked from commit 114b9c5)
why make this change?:
We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs.
test plan:
Manually tested the website - will insert a screenshot.
issue:
#9651