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

Add 'Test Utils' docs back to main navigation #9676

Merged
merged 4 commits into from
May 26, 2017

Conversation

flarnie
Copy link
Contributor

@flarnie flarnie commented May 12, 2017

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

@@ -32,6 +32,8 @@
title: JSX In Depth
- id: typechecking-with-proptypes
title: Typechecking With PropTypes
- id: test-utils
title: Test Utilities
Copy link
Collaborator

@gaearon gaearon May 12, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@@ -2,8 +2,6 @@
id: test-utils
title: Test Utilities
permalink: docs/test-utils.html
layout: docs
category: Reference
Copy link
Collaborator

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.

@flarnie
Copy link
Contributor Author

flarnie commented May 23, 2017

screen shot 2017-05-22 at 8 37 07 pm

@flarnie flarnie requested a review from sophiebits May 23, 2017 14:31
@flarnie
Copy link
Contributor Author

flarnie commented May 23, 2017

Going to add to this in order to correct the outdated 'shallow renderer' docs.

@flarnie
Copy link
Contributor Author

flarnie commented May 23, 2017

screen shot 2017-05-23 at 8 05 48 am

@flarnie
Copy link
Contributor Author

flarnie commented May 24, 2017

Sorry I left this so long - hopefully it's an easy review now.

Copy link
Collaborator

@gaearon gaearon left a 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?

@@ -252,32 +252,5 @@ Same as [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype) bu

## Shallow Rendering
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good~ will fix


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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "updated documentation".

Copy link
Contributor Author

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
@flarnie flarnie merged commit 114b9c5 into facebook:master May 26, 2017
@gaearon
Copy link
Collaborator

gaearon commented May 26, 2017

@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)
Copy link
Collaborator

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.

Copy link
Contributor Author

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!

gaearon pushed a commit that referenced this pull request Jun 9, 2017
* 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)
flarnie added a commit that referenced this pull request Jun 12, 2017
* 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)
@flarnie flarnie deleted the addBackTestUtilsDocs branch May 25, 2018 17:51
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.

3 participants