Skip to content

Commit

Permalink
Improve some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
antonhalim committed Aug 26, 2020
1 parent 5a10621 commit d9a3dba
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ practices.</p>
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [The problem](#the-problem)
- [This solution](#this-solution)
- [The solution](#the-solution)
- [Installation](#installation)
- [Suppressing unnecessary warnings on React DOM 16.8](#suppressing-unnecessary-warnings-on-react-dom-168)
- [Examples](#examples)
Expand Down Expand Up @@ -83,7 +83,7 @@ maintainable in the long run so refactors of your components (changes to
implementation but not functionality) don't break your tests and slow you and
your team down.

## This solution
## The solution

The `React Testing Library` is a very lightweight solution for testing React
components. It provides light utility functions on top of `react-dom` and
Expand All @@ -104,7 +104,7 @@ npm install --save-dev @testing-library/react

or

for installation via [yarn](https://classic.yarnpkg.com/en/)
for installation via [yarn][yarn]

```
yarn add --dev @testing-library/react
Expand Down Expand Up @@ -132,7 +132,7 @@ the following snippet to your test configuration

```js
// this is just a little hack to silence a warning that we'll get until we
// upgrade to 16.9: https://github.com/facebook/react/pull/14853
// upgrade to 16.9. See also: https://github.com/facebook/react/pull/14853
const originalError = console.error
beforeAll(() => {
console.error = (...args) => {
Expand All @@ -156,8 +156,8 @@ afterAll(() => {
// hidden-message.js
import React from 'react'

// NOTE: React Testing Library works with React Hooks _and_ classes just as well
// and your tests will be the same however you write your components.
// NOTE: React Testing Library works well with React Hooks and classes.
// Your tests will be the same whichever you write your components.
function HiddenMessage({children}) {
const [showMessage, setShowMessage] = React.useState(false)
return (
Expand Down Expand Up @@ -372,7 +372,7 @@ You can also find React Testing Library examples at
If you are interested in testing a custom hook, check out [React Hooks Testing
Library][react-hooks-testing-library].
> NOTE it is not recommended to test single-use custom hooks in isolation from
> NOTE: it is not recommended to test single-use custom hooks in isolation from
> the components where it's being used. It's better to test the component that's
> using the hook rather than the hook itself. The `React Hooks Testing Library`
> is intended to be used for reusable hooks/libraries.
Expand All @@ -383,7 +383,7 @@ Library][react-hooks-testing-library].
> confidence they can give you.][guiding-principle]
We try to only expose methods and utilities that encourage you to write tests
that closely resemble how your react components are used.
that closely resemble how your React components are used.
Utilities are included in this project based on the following guiding
principles:
Expand All @@ -397,8 +397,8 @@ principles:
`react-dom`.
3. Utility implementations and APIs should be simple and flexible.
At the end of the day, what we want is for this library to be pretty
light-weight, simple, and understandable.
Most importantly, we want React Testing Library to be pretty
light-weight, simple, and easy to understand.
## Docs
Expand All @@ -407,8 +407,8 @@ light-weight, simple, and understandable.
## Issues
_Looking to contribute? Look for the [Good First Issue][good-first-issue]
label._
Looking to contribute? Look for the [Good First Issue][good-first-issue]
label.
### 馃悰 Bugs
Expand Down Expand Up @@ -608,6 +608,7 @@ Contributions of any kind welcome!
<!-- prettier-ignore-start -->
[npm]: https://www.npmjs.com/
[yarn]: https://classic.yarnpkg.com
[node]: https://nodejs.org
[build-badge]: https://img.shields.io/travis/testing-library/react-testing-library.svg?style=flat-square
[build]: https://travis-ci.org/testing-library/react-testing-library
Expand Down

0 comments on commit d9a3dba

Please sign in to comment.