Skip to content

Commit 37f0c42

Browse files
fix: update package name in docs (callstack#462)
* fix: package reference in docs * fix: more references to package name * Update README.md Co-authored-by: Michał Pierzchała <[email protected]> * Update website/docs/GettingStarted.md Co-authored-by: Michał Pierzchała <[email protected]> * Update website/docs/API.md Co-authored-by: Michał Pierzchała <[email protected]>
1 parent 3f88cac commit 37f0c42

File tree

10 files changed

+44
-44
lines changed

10 files changed

+44
-44
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ labels: 'bug report'
3434
<!--
3535
run following command in terminal of your root project and paste the result down
3636
37-
`npx envinfo --npmPackages react,react-native,react-test-renderer,react-native-testing-library`
38-
-->
37+
`npx envinfo --npmPackages react,react-native,react-test-renderer,@testing-library/react-native`
38+
-->

Diff for: CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ You can report issues on our [bug tracker](https://github.com/callstack/react-na
6363

6464
## License
6565

66-
By contributing to `react-native-testing-library`, you agree that your contributions will be licensed under its **MIT** license.
66+
By contributing to `@testing-library/react-native`, you agree that your contributions will be licensed under its **MIT** license.

Diff for: README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ You finally want to approach testing using only best practices, while Enzyme may
2727

2828
## This solution
2929

30-
The `react-native-testing-library` is a lightweight solution for testing your React Native components. It provides light utility functions on top of `react-test-renderer` letting you always be up to date with latest React features and write any component tests you like. But really not any, it prevents you from testing implementation details because we stand this is a very bad practice.
30+
The React Native Testing Library is a lightweight solution for testing your React Native components. It provides light utility functions on top of `react-test-renderer` letting you always be up to date with latest React features and write any component tests you like. But really not any, it prevents you from testing implementation details because we stand this is a very bad practice.
3131

3232
This library is a replacement for [Enzyme](http://airbnb.io/enzyme/). It is tested to work with Jest, but it should work with other test runners as well.
3333

3434
## Example
3535

3636
```jsx
37-
import { render, fireEvent } from 'react-native-testing-library';
37+
import { render, fireEvent } from '@testing-library/react-native';
3838
import { QuestionsBoard } from '../QuestionsBoard';
3939

4040
test('form submits two answers', () => {
@@ -67,13 +67,13 @@ Open a Terminal in your project's folder and run:
6767
#### Using `yarn`
6868

6969
```sh
70-
yarn add --dev react-native-testing-library
70+
yarn add --dev @testing-library/react-native
7171
```
7272

7373
#### Using `npm`
7474

7575
```sh
76-
npm install --save-dev react-native-testing-library
76+
npm install --save-dev @testing-library/react-native
7777
```
7878

7979
This library has a peerDependencies listing for `react-test-renderer` and, of course, `react`. Make sure to install them too!
@@ -115,7 +115,7 @@ As you may have noticed, it's not tied to React Native at all – you can safely
115115

116116
## API / Usage
117117

118-
The [public API](https://callstack.github.io/react-native-testing-library/docs/api) of `react-native-testing-library` is focused around these essential methods:
118+
The [public API](https://callstack.github.io/react-native-testing-library/docs/api) of `@testing-library/react-native` is focused around these essential methods:
119119

120120
- [`render`](https://callstack.github.io/react-native-testing-library/docs/api#render) – deeply renders given React element and returns helpers to query the output components.
121121
- [`fireEvent`](https://callstack.github.io/react-native-testing-library/docs/api#fireevent) - invokes named event handler on the element.

Diff for: pure.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// makes it so people can import from 'react-native-testing-library/pure'
1+
// makes it so people can import from '@testing-library/react-native/pure'
22
module.exports = require('./build/pure');

Diff for: src/helpers/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function printDeprecationWarning(functionName: string) {
3333

3434
console.warn(`
3535
Deprecation Warning:
36-
Use of ${functionName} is not recommended and will be deleted in future versions of react-native-testing-library.
36+
Use of ${functionName} is not recommended and will be deleted in future versions of @testing-library/react-native.
3737
`);
3838

3939
warned[functionName] = true;

Diff for: website/docs/API.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: api
33
title: API
44
---
55

6-
This page gathers public API of `react-native-testing-library` along with usage examples.
6+
This page gathers public API of React Native Testing Library along with usage examples.
77

88
## `render`
99

@@ -26,7 +26,7 @@ function render(
2626
Deeply renders given React element and returns helpers to query the output components structure.
2727

2828
```jsx
29-
import { render } from 'react-native-testing-library';
29+
import { render } from '@testing-library/react-native';
3030
import { QuestionsBoard } from '../QuestionsBoard';
3131

3232
test('should verify two questions', () => {
@@ -50,7 +50,7 @@ See [Queries](./Queries.md) for a complete list.
5050
#### Example
5151

5252
```jsx
53-
import { render } from 'react-native-testing-library';
53+
import { render } from '@testing-library/react-native';
5454

5555
const { getByText, queryByA11yStates } = render(<Component />);
5656
```
@@ -134,7 +134,7 @@ Please note that this is done automatically if the testing framework you're usin
134134
For example, if you're using the `jest` testing framework, then you would need to use the `afterEach` hook like so:
135135

136136
```jsx
137-
import { cleanup, render } from 'react-native-testing-library/pure';
137+
import { cleanup, render } from '@testing-library/react-native/pure';
138138
import { View } from 'react-native';
139139

140140
afterEach(cleanup);
@@ -173,7 +173,7 @@ Fires native-like event with data.
173173
Invokes a given event handler (whether native or custom) on the element, bubbling to the root of the rendered tree.
174174

175175
```jsx
176-
import { render, fireEvent } from 'react-native-testing-library';
176+
import { render, fireEvent } from '@testing-library/react-native';
177177

178178
test('fire changeText event', () => {
179179
const onEventMock = jest.fn();
@@ -192,7 +192,7 @@ An example using `fireEvent` with native events that aren't already aliased by t
192192

193193
```jsx
194194
import { TextInput, View } from 'react-native';
195-
import { fireEvent, render } from 'react-native-testing-library';
195+
import { fireEvent, render } from '@testing-library/react-native';
196196

197197
const onBlurMock = jest.fn();
198198

@@ -220,7 +220,7 @@ Invokes `press` event handler on the element or parent element in the tree.
220220

221221
```jsx
222222
import { View, Text, TouchableOpacity } from 'react-native';
223-
import { render, fireEvent } from 'react-native-testing-library';
223+
import { render, fireEvent } from '@testing-library/react-native';
224224

225225
const onPressMock = jest.fn();
226226

@@ -242,7 +242,7 @@ Invokes `changeText` event handler on the element or parent element in the tree.
242242

243243
```jsx
244244
import { View, TextInput } from 'react-native';
245-
import { render, fireEvent } from 'react-native-testing-library';
245+
import { render, fireEvent } from '@testing-library/react-native';
246246

247247
const onChangeTextMock = jest.fn();
248248
const CHANGE_TEXT = 'content';
@@ -264,7 +264,7 @@ Invokes `scroll` event handler on the element or parent element in the tree.
264264

265265
```jsx
266266
import { ScrollView, Text } from 'react-native';
267-
import { render, fireEvent } from 'react-native-testing-library';
267+
import { render, fireEvent } from '@testing-library/react-native';
268268

269269
const onScrollMock = jest.fn();
270270
const eventData = {
@@ -288,7 +288,7 @@ fireEvent.scroll(getByText('scroll-view'), eventData);
288288

289289
```jsx
290290
import { FlatList, View } from 'react-native';
291-
import { render, fireEvent } from 'react-native-testing-library';
291+
import { render, fireEvent } from '@testing-library/react-native';
292292

293293
const onEndReached = jest.fn();
294294
const { getByType } = render(
@@ -337,7 +337,7 @@ function waitFor<T>(
337337
Waits for non-deterministic periods of time until your element appears or times out. `waitFor` periodically calls `expectation` every `interval` milliseconds to determine whether the element appeared or not.
338338

339339
```jsx
340-
import { render, waitFor } from 'react-native-testing-library';
340+
import { render, waitFor } from '@testing-library/react-native';
341341

342342
test('waiting for an Banana to be ready', async () => {
343343
const { getByText } = render(<Banana />);
@@ -371,7 +371,7 @@ Waits for non-deterministic periods of time until queried element is removed or
371371
import {
372372
render,
373373
waitForElementToBeRemoved,
374-
} from 'react-native-testing-library';
374+
} from '@testing-library/react-native';
375375

376376
test('waiting for an Banana to be removed', async () => {
377377
const { getByText } = render(<Banana />);
@@ -425,7 +425,7 @@ Use cases for scoped queries include:
425425
Each of the get APIs listed in the render section above have a complimentary query API. The get APIs will throw errors if a proper node cannot be found. This is normally the desired effect. However, if you want to make an assertion that an element is not present in the hierarchy, then you can use the query API instead:
426426

427427
```jsx
428-
import { render } from 'react-native-testing-library';
428+
import { render } from '@testing-library/react-native';
429429

430430
const { queryByText } = render(<Form />);
431431
const submitButton = queryByText('submit');
@@ -437,7 +437,7 @@ expect(submitButton).toBeNull(); // it doesn't exist
437437
Each of the query APIs have a corresponding queryAll version that always returns an Array of matching nodes. getAll is the same but throws when the array has a length of 0.
438438

439439
```jsx
440-
import { render } from 'react-native-testing-library';
440+
import { render } from '@testing-library/react-native';
441441

442442
const { queryAllByText } = render(<Forms />);
443443
const submitButtons = queryAllByText('submit');

Diff for: website/docs/GettingStarted.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ You finally want to approach testing using only best practices, while Enzyme may
1313

1414
## This solution
1515

16-
The `react-native-testing-library` is a lightweight solution for testing your React Native components. It provides light utility functions on top of `react-test-renderer` letting you always be up to date with latest React features and write any component tests you like. It also prevents you from testing implementation details because we believe this is a very bad practice.
16+
The React Native Testing Library is a lightweight solution for testing your React Native components. It provides light utility functions on top of `react-test-renderer` letting you always be up to date with latest React features and write any component tests you like. It also prevents you from testing implementation details because we believe this is a very bad practice.
1717

1818
This library is a replacement for [Enzyme](http://airbnb.io/enzyme/).
1919

2020
## Example
2121

2222
```jsx
23-
import { render, fireEvent } from 'react-native-testing-library';
23+
import { render, fireEvent } from '@testing-library/react-native';
2424
import { QuestionsBoard } from '../QuestionsBoard';
2525

2626
test('form submits two answers', () => {
@@ -53,13 +53,13 @@ Open a Terminal in your project's folder and run:
5353
#### Using `yarn`
5454

5555
```sh
56-
yarn add --dev react-native-testing-library
56+
yarn add --dev @testing-library/react-native
5757
```
5858

5959
#### Using `npm`
6060

6161
```sh
62-
npm install --save-dev react-native-testing-library
62+
npm install --save-dev @testing-library/react-native
6363
```
6464

6565
This library has a peerDependencies listing for `react-test-renderer` and, of course, `react`. Make sure to install them too!

Diff for: website/docs/Queries.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Returns a `ReactTestInstance` with matching text – may be a string or regular
6262
This method will join `<Text>` siblings to find matches, similarly to [how React Native handles these components](https://facebook.github.io/react-native/docs/text#containers). This will allow for querying for strings that will be visually rendered together, but may be semantically separate React components.
6363

6464
```jsx
65-
import { render } from 'react-native-testing-library';
65+
import { render } from '@testing-library/react-native';
6666

6767
const { getByText } = render(<MyComponent />);
6868
const element = getByText('banana');
@@ -75,7 +75,7 @@ const element = getByText('banana');
7575
Returns a `ReactTestInstance` for a `TextInput` with a matching placeholder – may be a string or regular expression.
7676

7777
```jsx
78-
import { render } from 'react-native-testing-library';
78+
import { render } from '@testing-library/react-native';
7979

8080
const { getByPlaceholderText } = render(<MyComponent />);
8181
const element = getByPlaceholderText('username');
@@ -88,7 +88,7 @@ const element = getByPlaceholderText('username');
8888
Returns a `ReactTestInstance` for a `TextInput` with a matching display value – may be a string or regular expression.
8989

9090
```jsx
91-
import { render } from 'react-native-testing-library';
91+
import { render } from '@testing-library/react-native';
9292

9393
const { getByDisplayValue } = render(<MyComponent />);
9494
const element = getByDisplayValue('username');
@@ -101,7 +101,7 @@ const element = getByDisplayValue('username');
101101
Returns a `ReactTestInstance` with matching `testID` prop.
102102

103103
```jsx
104-
import { render } from 'react-native-testing-library';
104+
import { render } from '@testing-library/react-native';
105105

106106
const { getByTestId } = render(<MyComponent />);
107107
const element = getByTestId('unique-id');
@@ -120,7 +120,7 @@ Please be mindful when using these API and **treat it as an escape hatch**. Your
120120
Returns a `ReactTestInstance` with matching `accessibilityLabel` prop.
121121

122122
```jsx
123-
import { render } from 'react-native-testing-library';
123+
import { render } from '@testing-library/react-native';
124124

125125
const { getByA11yLabel } = render(<MyComponent />);
126126
const element = getByA11yLabel('my-label');
@@ -135,7 +135,7 @@ const element = getByA11yLabel('my-label');
135135
Returns a `ReactTestInstance` with matching `accessibilityHint` prop.
136136

137137
```jsx
138-
import { render } from 'react-native-testing-library';
138+
import { render } from '@testing-library/react-native';
139139

140140
const { getByA11yHint } = render(<MyComponent />);
141141
const element = getByA11yHint('my-hint');
@@ -149,7 +149,7 @@ const element = getByA11yHint('my-hint');
149149
Returns a `ReactTestInstance` with matching `accessibilityStates` prop.
150150

151151
```jsx
152-
import { render } from 'react-native-testing-library';
152+
import { render } from '@testing-library/react-native';
153153

154154
const { getByA11yStates } = render(<MyComponent />);
155155
const element = getByA11yStates(['checked']);
@@ -165,7 +165,7 @@ const element2 = getByA11yStates('checked');
165165
Returns a `ReactTestInstance` with matching `accessibilityRole` prop.
166166

167167
```jsx
168-
import { render } from 'react-native-testing-library';
168+
import { render } from '@testing-library/react-native';
169169

170170
const { getByA11yRole } = render(<MyComponent />);
171171
const element = getByA11yRole('button');
@@ -179,7 +179,7 @@ const element = getByA11yRole('button');
179179
Returns a `ReactTestInstance` with matching `accessibilityState` prop.
180180

181181
```jsx
182-
import { render } from 'react-native-testing-library';
182+
import { render } from '@testing-library/react-native';
183183

184184
const { getByA11yState } = render(<Component />);
185185
const element = getByA11yState({ disabled: true });
@@ -193,7 +193,7 @@ const element = getByA11yState({ disabled: true });
193193
Returns a `ReactTestInstance` with matching `accessibilityValue` prop.
194194

195195
```jsx
196-
import { render } from 'react-native-testing-library';
196+
import { render } from '@testing-library/react-native';
197197

198198
const { getByA11yValue } = render(<Component />);
199199
const element = getByA11yValue({ min: 40 });
@@ -203,7 +203,7 @@ const element = getByA11yValue({ min: 40 });
203203

204204
> Use sparingly and responsibly, escape hatches here
205205
206-
`render` from `react-native-testing-library` exposes additional queries that **should not be used in component integration testing**, but some users (like component library creators) interested in unit testing some components may find helpful.
206+
`render` from `@testing-library/react-native` exposes additional queries that **should not be used in component integration testing**, but some users (like component library creators) interested in unit testing some components may find helpful.
207207

208208
<details>
209209
<summary>Queries helpful in unit testing</summary>

Diff for: website/docs/ReactNavigation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: react-navigation
33
title: React Navigation
44
---
55

6-
This section deals with integrating `react-native-testing-library` with `react-navigation`, using Jest.
6+
This section deals with integrating `@testing-library/react-native` with `react-navigation`, using Jest.
77

88
## Setting up
99

@@ -127,7 +127,7 @@ const styles = StyleSheet.create({
127127
Install required dev dependencies:
128128

129129
```
130-
$ yarn add -D jest react-native-testing-library
130+
$ yarn add -D jest @testing-library/react-native
131131
```
132132

133133
Create your `jest.config.js` file (or place the following properties in your `package.json` as a "jest" property)
@@ -154,7 +154,7 @@ Let's a [`AppNavigator.test.js`](https://github.com/callstack/react-native-testi
154154
```jsx
155155
import React from 'react';
156156
import { NavigationContainer } from '@react-navigation/native';
157-
import { render, fireEvent } from 'react-native-testing-library';
157+
import { render, fireEvent } from '@testing-library/react-native';
158158

159159
import AppNavigator from '../AppNavigator';
160160

Diff for: website/docs/ReduxIntegration.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For `./components/AddTodo.test.js`
1818
```jsx
1919
import React from 'react';
2020
import { Provider } from 'react-redux';
21-
import { cleanup, fireEvent, render } from 'react-native-testing-library';
21+
import { cleanup, fireEvent, render } from '@testing-library/react-native';
2222
import configureStore from '../store';
2323
import AddTodo from './AddTodo';
2424

@@ -65,7 +65,7 @@ For the `./components/TodoList.js`
6565
```jsx
6666
import React from 'react';
6767
import { Provider } from 'react-redux';
68-
import { fireEvent, render } from 'react-native-testing-library';
68+
import { fireEvent, render } from '@testing-library/react-native';
6969
import configureStore from '../store';
7070
import TodoList from './TodoList';
7171

0 commit comments

Comments
 (0)