Skip to content

Commit ab679c9

Browse files
docs: spell-check the docs (#1529)
1 parent 413ad21 commit ab679c9

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

website/docs/FAQ.md

+16-18
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,40 @@ id: faq
33
title: FAQ
44
---
55

6-
<details>
7-
<summary>Can I test native features of React Native apps?</summary>
6+
#### Can I test the native features of React Native apps?
87

9-
<p>Short answer: no.</p>
8+
Short answer: no.
109

11-
React Native Testing Library does not provide a full React Native runtime since that would require running on physical device
10+
React Native Testing Library does not provide an entire React Native runtime since that would require running on a physical device
1211
or iOS simulator/Android emulator to provision the underlying OS and platform APIs.
1312

14-
Instead of using React Native renderer, it simulates only the JavaScript part of its runtime by
13+
Instead of using React Native renderer, it simulates only the JavaScript part of its runtime
1514
using [React Test Renderer](https://reactjs.org/docs/test-renderer.html) while providing queries
16-
and `fireEvent` APIs that mimick certain behaviors from the real runtime.
15+
and event APIs (`userEvent`, `fireEvent`) that mimicking certain behaviors from the actual runtime.
1716

1817
You can learn more about our testing environment [here](./TestingEnvironment.md).
1918

20-
This approach has certain benefits and shortfalls. On the positive side:
19+
This approach has specific benefits and shortfalls. On the positive side:
2120

2221
- it allows testing most of the logic of regular React Native apps
23-
- it allows running test on any OS supported by Jest, or other test runner, e.g. on CI
22+
- it allows running tests on any OS supported by Jest or other test runners, e.g., on CI
2423
- it uses much less resources than full runtime simulation
2524
- you can use Jest fake timers
2625

27-
The the negative side:
26+
On the negative side:
2827

2928
- you cannot test native features
30-
- certain JavaScript features might not be perfectly simulated, but we are working on it
29+
- it might not perfectly simulate certain JavaScript features, but we are working on it
3130

32-
For instance, [react-native's ScrollView](https://reactnative.dev/docs/scrollview) has several props that depend on native calls. While you can trigger `onScroll` call with `fireEvent.scroll`, `onMomentumScrollBegin` is called from the native side and will therefore not be called.
31+
The [User Event interactions](user-event) solve some of the simulation issues, as they offer more realistic event handling than the basic [Fire Event API](api#fireevent-api).
3332

34-
</details>
35-
36-
<details>
37-
<summary>Should I use/migrate to `screen` queries?</summary>
33+
### Should I use/migrate to `screen` queries?
3834

3935
There is no need to migrate existing test code to use `screen`-bases queries. You can still use
40-
queries and other functions returned by `render`. In fact `screen` hold just that value, the latest `render` result.
36+
queries and other functions returned by `render`. The `screen` object captures the latest `render` result.
37+
38+
For new code, you are encouraged to use `screen` as there are some good reasons for that, which are described in [this article](https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen) by Kent C. Dodds.
4139

42-
For newer code you can either use `screen` or `render` result destructuring. However, there are some good reasons to use `screen`, which are described in [this article](https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen) by Kent C. Dodds.
40+
### Should I use/migrate to User Event interactions?
4341

44-
</details>
42+
We encourage you to migrate existing tests to use the [User Event interactions](user-event), which offer more realistic event handling than the basic [Fire Event API](api#fireevent-api). Hence, it will provide more confidence in the quality of your code.

website/docs/GettingStarted.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ title: Getting Started
55

66
## The problem
77

8-
You want to write maintainable tests for your React Native components. As a part of this goal, you want your tests to avoid including implementation details of your components and rather focus on making your tests give you the confidence for which they are intended. As part of this, you want your testbase to be 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.
8+
You want to write maintainable tests for your React Native components. As a part of this goal, you want your tests to avoid including implementation details of your components and focus on making your tests give you the confidence they are intended. As part of this, you want your tests to be 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.
99

1010
## This solution
1111

12-
The React Native Testing Library (RNTL) is a lightweight solution for testing React Native components. It provides light utility functions on top of `react-test-renderer`, in a way that encourages better testing practices. Its primary guiding principle is:
12+
The React Native Testing Library (RNTL) is a lightweight solution for testing React Native components. It provides light utility functions on top of React Test Renderer, in a way that encourages better testing practices. Its primary guiding principle is:
1313

14-
> The more your tests resemble the way your software is used, the more confidence they can give you.
14+
> The more your tests resemble how your software is used, the more confidence they can give you.
1515
16-
This project is inspired by [React Testing Library](https://github.com/testing-library/react-testing-library). Tested to work with Jest, but it should work with other test runners as well.
16+
This project is inspired by [React Testing Library](https://github.com/testing-library/react-testing-library). It is tested to work with Jest, but it should work with other test runners as well.
1717

18-
You can find the source of `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/main/src/__tests__/questionsBoard.test.tsx).
18+
You can find the source of the `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/main/src/__tests__/questionsBoard.test.tsx).
1919

2020
## Installation
2121

@@ -33,15 +33,15 @@ yarn add --dev @testing-library/react-native
3333
npm install --save-dev @testing-library/react-native
3434
```
3535

36-
This library has a `peerDependencies` listing for `react-test-renderer`. Make sure that your `react-test-renderer` version matches exactly your `react` version.
36+
This library has a peer dependency for `react-test-renderer` package. Make sure that your `react-test-renderer` version matches exactly your `react` version.
3737

3838
:::info
39-
In order to properly use helpers for async tests (`findBy` queries and `waitFor`) you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.61 (which comes with React >=16.9.0).
39+
To properly use helpers for async tests (`findBy` queries and `waitFor`), you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.61 (which comes with React >=16.9.0).
4040
:::
4141

4242
### Additional Jest matchers
4343

44-
In order to use additional React Native-specific Jest matchers add the following line to your `jest-setup.ts` file (configured using [`setupFilesAfterEnv`](https://jestjs.io/docs/configuration#setupfilesafterenv-array)):
44+
To use additional React Native-specific Jest matchers, add the following line to your `jest-setup.ts` file (configured using [`setupFilesAfterEnv`](https://jestjs.io/docs/configuration#setupfilesafterenv-array)):
4545

4646
```ts
4747
import '@testing-library/react-native/extend-expect';
@@ -80,4 +80,4 @@ test('form submits two answers', () => {
8080
});
8181
```
8282

83-
You can find the source of `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/main/src/__tests__/questionsBoard.test.tsx).
83+
You can find the source of the `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/main/src/__tests__/questionsBoard.test.tsx).

0 commit comments

Comments
 (0)