Skip to content

Commit

Permalink
Matt's review (partial)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt <github@nospam.33m.co>
  • Loading branch information
eps1lon and mbrookes authored Jul 21, 2020
1 parent a220764 commit 07a8acf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/src/pages/guides/testing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

## Userspace

We recommend testing your application without tying the tests too close to Material-UI.
This is how we test our components internally.
It's generally recommended to test your application without tying the tests too closely to Material-UI.
This is how Material-UI components are tested internally.
A library that has a first-class API for this approach is [`@testing-library/react`](https://testing-library.com/docs/react-testing-library/intro).

For example, when rendering a `TextField` your test should not need to query for the specific Material-UI instance of the `TextField` but rather for the `input`, or the `[role="textbox"]`.
For example, when rendering a `TextField` your test should not need to query for the specific Material-UI instance of the `TextField` but rather for the `input`, or `[role="textbox"]`.

By not relying on the React component tree you make your test more robust against internal changes in Material-UI or, if you need snapshot testing, adding additional wrapper components such as context providers.
Though we don't recommend snapshot testing.
We don't recommend snapshot testing though.
["Effective snapshot testing" by Kent C. Dodds](https://kentcdodds.com/blog/effective-snapshot-testing) goes into more details why snapshot testing might be misleading for React component tests.

## Internal
Expand Down

0 comments on commit 07a8acf

Please sign in to comment.