-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[docs] Add testing section #7101
Conversation
oliviertassinari
commented
Jun 10, 2017
•
edited
Loading
edited
- Yes, 97% coverage 😍 .
- Normalise the badges with shields
- Normalise and clean the test API
- Closes Material UI components complicate testing of other (general) components significantly #4664
## Internal | ||
|
||
We take tests seriously, we have written and we maintain **a wide range** of tests so we can | ||
iterate with confidence on the components. For instance, the visual regression tests provided by [Argos-CI](https://www.argos-ci.com/callemall/material-ui) have proven to be really helpful. |
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.
😄 Well I guess you deserve the link juice!
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.
Thanks for the review 🥝
docs/src/pages/guides/testing.md
Outdated
|
||
## Userspace | ||
|
||
But what about writing tests in userspace? Material-UI styling infrastructure relies on the context feature of React to work correcly. You are going to need that context when testing your react components with ours. |
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.
'correctly"
docs/src/pages/guides/testing.md
Outdated
### Shallow rendering | ||
|
||
Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure that your tests aren't indirectly asserting on behavior of child components. | ||
We expose a `createShallow()` function for that situation. However, you will most likely not need it for most of the simple situations. |
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 situation'
'not need it most of the time.'
docs/src/pages/guides/testing.md
Outdated
### Full DOM rendering | ||
|
||
Full DOM rendering is ideal for use cases where you have components that may interact with DOM APIs, or may require the full lifecycle in order to fully test the component (i.e., `componentDidMount` etc.). | ||
We expose a `createMount()` function for that situation. |
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 situation.'
docs/src/pages/guides/testing.md
Outdated
|
||
Rendering to string is useful to test the behavior of the components that are used on the server. | ||
You can take advantage of it to assert the generated HTML string. | ||
We expose a `createRender()` function for that sitation. |
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 situation'
docs/src/pages/guides/testing.md
Outdated
### `createShallow([options]) => shallow` | ||
|
||
Generate an enhanced shallow function with the needed context. | ||
You can find the API of the `shallow` function following [that link](http://airbnb.io/enzyme/docs/api/shallow.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.
'this link' (although good practice is that the anchor text is somewhat descriptive of the target: 'Please refer to the API documentation for further details of the shallow function
.'
docs/src/pages/guides/testing.md
Outdated
### `createMount([options]) => mount` | ||
|
||
Generate an enhanced mount function with the needed context. | ||
You can find the API of the `mount` function following [that link](http://airbnb.io/enzyme/docs/api/mount.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.
As before.
docs/src/pages/guides/testing.md
Outdated
### `createRender([options]) => render` | ||
|
||
Generate a render to string function with the needed context. | ||
You can find the API of the `render` function following [that link](http://airbnb.io/enzyme/docs/api/render.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.
Same.
AND... it's gone :( |
@FDiskas What do you mean? |
Can't find this in v0.19.2 |
@FDiskas You will find it on the documentation of the v1-beta branch. |