Skip to content

Commit 73bef94

Browse files
docs: improve api docs (#1590)
1 parent c81c89b commit 73bef94

17 files changed

+897
-905
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,16 @@ You can find the source of `QuestionsBoard` component and this example [here](ht
119119

120120
## API / Usage
121121

122-
The [public API](https://callstack.github.io/react-native-testing-library/docs/api) of `@testing-library/react-native` is focused around these essential methods:
123-
124-
- [`render`](https://callstack.github.io/react-native-testing-library/docs/api#render) – deeply renders the given React element and returns helpers to query the output components.
125-
- [`fireEvent`](https://callstack.github.io/react-native-testing-library/docs/api#fireevent) - invokes named event handler on the element.
126-
- [`waitFor`](https://callstack.github.io/react-native-testing-library/docs/api#waitfor) - waits for non-deterministic periods of time until the queried element is added or times out.
127-
- [`waitForElementToBeRemoved`](https://callstack.github.io/react-native-testing-library/docs/api#waitforelementtoberemoved) - waits for non-deterministic periods of time until the queried element is removed or times out.
128-
- [`within`](https://callstack.github.io/react-native-testing-library/docs/api#within) - creates a queries object scoped for a given element.
122+
The public API of `@testing-library/react-native` is focused around these essential APIs:
123+
124+
- [`render`](https://callstack.github.io/react-native-testing-library/docs/render) – renders the given React element
125+
- [`screen`](https://callstack.github.io/react-native-testing-library/docs/screen) – queries for looking up rendered elements, as well as some useful helpers.
126+
- [`userEvent`](https://callstack.github.io/react-native-testing-library/docs/user-event) - realistic simulation of user interaction with elements like buttons and text inputs.
127+
- [`fireEvent`](https://callstack.github.io/react-native-testing-library/docs/fire-event) - general purpose event simulation.
128+
- [Jest matchers](https://callstack.github.io/react-native-testing-library/docs/jest-matchers) - validate assumptions about your components.
129+
- [`waitFor`](https://callstack.github.io/react-native-testing-library/docs/other#waitfor) - waits for non-deterministic periods of time until the queried element is added or times out.
130+
- [`waitForElementToBeRemoved`](https://callstack.github.io/react-native-testing-library/docs/other#waitforelementtoberemoved) - waits for non-deterministic periods of time until the queried element is removed or times out.
131+
- [`within`](https://callstack.github.io/react-native-testing-library/docs/other#within) - creates a queries object scoped for a given element.
129132

130133
## Migration Guides
131134

src/__tests__/questionsBoard.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ test('form submits two answers', async () => {
4646
render(<QuestionsBoard questions={questions} onSubmit={onSubmit} />);
4747

4848
const answerInputs = screen.getAllByLabelText('answer input');
49-
50-
// simulates the user focusing on TextInput and typing text one char at a time
5149
await user.type(answerInputs[0], 'a1');
5250
await user.type(answerInputs[1], 'a2');
53-
54-
// simulates the user pressing on any pressable element
5551
await user.press(screen.getByRole('button', { name: 'Submit' }));
5652

5753
expect(onSubmit).toHaveBeenCalledWith({

0 commit comments

Comments
 (0)