Skip to content

Commit ab2cebb

Browse files
afontcuKent C. Dodds
authored and
Kent C. Dodds
committed
Update Testing Libraries naming in docs (#125)
* Update import statements * Update library name * Update unpkg URL * Fix main exports section * Remove backticks * Update vue-testing-library references * Update cypress-testing-library references * Update react-testing-library import statements * Update react-testing-library references * Rename native-testing-library imports * Update native-testing-library references * Rename jest-native references
1 parent bc73c6c commit ab2cebb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+183
-183
lines changed

.vscode/markdown.code-snippets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
"",
2828
"<!--Native-->",
2929
"```js",
30-
"import { $1 } from 'dom-testing-library'",
30+
"import { $1 } from '@testing-library/dom'",
3131
"",
3232
"const container = document.body",
3333
"const $3 = $1(container, '$2')",
3434
"```",
3535
"",
3636
"<!--React-->",
3737
"```js",
38-
"import { render } from 'react-testing-library'",
38+
"import { render } from '@testing-library/react'",
3939
"",
4040
"const { $1 } = render(<MyComponent />)",
4141
"const $3 = $1('$2')",
@@ -50,4 +50,4 @@
5050
],
5151
"description": "Create a Docusaurus multi-language code block"
5252
}
53-
}
53+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ testing-library-docs
88
[![Code of Conduct][coc-badge]][coc]
99
<!-- prettier-ignore-end -->
1010

11-
Documentation site for [react-testing-library](https://github.com/testing-library/react-testing-library), [dom-testing-library](https://github.com/testing-library/dom-testing-library), and [related projects](https://github.com/testing-library)
11+
Documentation site for [React Testing Library](https://github.com/testing-library/react-testing-library), [DOM Testing Library](https://github.com/testing-library/dom-testing-library), and [related projects](https://github.com/testing-library)
1212

1313
See [./website/README.md](./website/README.md) for instructions on building the site
1414

docs/angular-testing-library/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ after each interaction.
7676
You can also import these event via `@angular-extensions/testing-library`, but
7777
the Angular's change detection will not be triggered automatically.
7878

79-
The same counts for all the queries provided by `dom-testing-library`, these are
79+
The same counts for all the queries provided by `DOM Testing Library`, these are
8080
also re-exported and can be imported via `@angular-extensions/testing-library`.
8181

8282
```typescript

docs/bs-react-testing-library/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Bindings for several testing libraries have been ported to [ReasonML][re].
88

99
[`bs-react-testing-library`][gh-react] contains
1010
[BuckleScript](https://bucklescript.github.io/) bindings for
11-
`react-testing-library`.
11+
`React Testing Library`.
1212

1313
[`bs-dom-testing-library`][gh-dom] contains [BuckleScript][bs] bindings for
14-
`dom-testing-library`.
14+
`DOM Testing Library`.
1515

1616
```
1717
npm install --save-dev bs-dom-testing-library

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_label: Contributing
66

77
## License
88

9-
`react-testing-library` is distributed under the open-source MIT license
9+
`React Testing Library` is distributed under the open-source MIT license
1010

1111
## Issues
1212

docs/cypress-testing-library/intro.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ id: intro
33
title: Cypress Testing Library
44
---
55

6-
[`cypress-testing-library`][gh] allows the use of dom-testing queries within
6+
[`Cypress Testing Library`][gh] allows the use of dom-testing queries within
77
[Cypress](https://cypress.io) end-to-end browser tests.
88

99
```
10-
npm install --save-dev cypress cypress-testing-library
10+
npm install --save-dev cypress @testing-library/cypress
1111
```
1212

13-
- [cypress-testing-library on GitHub][gh]
13+
- [Cypress Testing Library on GitHub][gh]
1414

1515
## Usage
1616

17-
`cypress-testing-library` extends Cypress' `cy` command.
17+
`Cypress Testing Library` extends Cypress' `cy` command.
1818

1919
Add this line to your project's `cypress/support/commands.js`:
2020

2121
```
22-
import 'cypress-testing-library/add-commands';
22+
import '@testing-library/cypress/add-commands';
2323
```
2424

25-
You can now use all of `dom-testing-library`'s `getBy`, `getAllBy`, `queryBy`
25+
You can now use all of `DOM Testing Library`'s `getBy`, `getAllBy`, `queryBy`
2626
and `queryAllBy` commands.
27-
[See `dom-testing-library` API for reference](dom-testing-library/api-queries.md)
27+
[See `DOM Testing Library` API for reference](dom-testing-library/api-queries.md)
2828

2929
## Examples
3030

@@ -44,10 +44,10 @@ cy.get('form').then(subject => {
4444
})
4545
```
4646

47-
`cypress-testing-library` supports both jQuery elements and DOM nodes. This is
48-
necessary because Cypress uses jQuery elements, while `dom-testing-library`
47+
`Cypress Testing Library` supports both jQuery elements and DOM nodes. This is
48+
necessary because Cypress uses jQuery elements, while `DOM Testing Library`
4949
expects DOM nodes. When you pass a jQuery element as `container`, it will get
5050
the first DOM node from the collection and use that as the `container` parameter
51-
for the `dom-testing-library` functions.
51+
for the DOM Testing Library functions.
5252

5353
[gh]: https://github.com/testing-library/cypress-testing-library

docs/dom-testing-library/api-configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Defaults to `data-testid`. See [`getByTestId`](#getbytestid).
2828

2929
```js
3030
// setup-tests.js
31-
import { configure } from 'dom-testing-library'
31+
import { configure } from '@testing-library/dom'
3232

3333
configure({testIdAttribute: 'my-data-test-id'})`
3434
```
@@ -37,7 +37,7 @@ configure({testIdAttribute: 'my-data-test-id'})`
3737

3838
```js
3939
// setup-tests.js
40-
import { configure } from 'react-testing-library'
40+
import { configure } from '@testing-library/react'
4141
4242
configure({testIdAttribute: 'my-data-test-id'})`
4343
```

docs/dom-testing-library/api-helpers.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ title: Helpers
55

66
## Custom Queries
77

8-
`dom-testing-library` exposes many of the helper functions that are used to
8+
`DOM Testing Library` exposes many of the helper functions that are used to
99
implement the default queries. You can use the helpers to build custom queries.
1010
For example, the code below shows a way to override the default `testId` queries
1111
to use a different data-attribute. (Note: test files would import
12-
`test-utils.js` instead of using `dom-testing-library` directly).
12+
`test-utils.js` instead of using `DOM Testing Library` directly).
1313

1414
```js
1515
// test-utils.js
16-
const domTestingLib = require('dom-testing-library')
16+
const domTestingLib = require('@testing-library/dom')
1717
const { queryHelpers } = domTestingLib
1818

1919
export const queryByTestId = queryHelpers.queryByAttribute.bind(
@@ -52,7 +52,7 @@ module.exports = {
5252

5353
> **Note**
5454
>
55-
> Custom queries can be added to `react-testing-library`'s `render` method by
55+
> Custom queries can be added to `React Testing Library`'s `render` method by
5656
> adding `queries` to the options config object. See the render
5757
> [options](/docs/react-testing-library/api#render-options).
5858
@@ -106,7 +106,7 @@ These elements use the attribute `value` and display its value to the user.
106106
`within` (an alias to `getQueriesForElement`) takes a DOM element and binds it
107107
to the raw query functions, allowing them to be used without specifying a
108108
container. It is the recommended approach for libraries built on this API and is
109-
in use in `react-testing-library` and `vue-testing-library`.
109+
in use in `React Testing Library` and `Vue Testing Library`.
110110

111111
Example: To get the text 'hello' only within a section called 'messages', you
112112
could do:
@@ -116,7 +116,7 @@ could do:
116116
<!--Native-->
117117

118118
```js
119-
import { within } from 'dom-testing-library'
119+
import { within } from '@testing-library/dom'
120120

121121
const { getByText } = within(document.getElementById('messages'))
122122
const helloMessage = getByText('hello')
@@ -125,7 +125,7 @@ const helloMessage = getByText('hello')
125125
<!--React-->
126126

127127
```js
128-
import { render, within } from 'react-testing-library'
128+
import { render, within } from '@testing-library/react'
129129

130130
const { getByLabelText } = render(<MyComponent />)
131131
const signinModal = getByLabelText('Sign In')

docs/dom-testing-library/api-queries.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The example below will find the input node for the following DOM structures:
107107
<!--Native-->
108108

109109
```javascript
110-
import { getByLabelText } from 'dom-testing-library'
110+
import { getByLabelText } from '@testing-library/dom'
111111

112112
const container = document.body
113113
const inputNode = getByLabelText(container, 'Username')
@@ -116,7 +116,7 @@ const inputNode = getByLabelText(container, 'Username')
116116
<!--React-->
117117

118118
```js
119-
import { render } from 'react-testing-library'
119+
import { render } from '@testing-library/react'
120120

121121
const { getByLabelText } = render(<Login />)
122122

@@ -172,7 +172,7 @@ matches the given [`TextMatch`](#textmatch).
172172
<!--Native-->
173173

174174
```js
175-
import { getByPlaceholderText } from 'dom-testing-library'
175+
import { getByPlaceholderText } from '@testing-library/dom'
176176

177177
const container = document.body
178178
const inputNode = getByPlaceholderText(container, 'Username')
@@ -181,7 +181,7 @@ const inputNode = getByPlaceholderText(container, 'Username')
181181
<!--React-->
182182

183183
```js
184-
import { render } from 'react-testing-library'
184+
import { render } from '@testing-library/react'
185185

186186
const { getByPlaceholderText } = render(<MyComponent />)
187187
const inputNode = getByPlaceholderText('Username')
@@ -229,7 +229,7 @@ matching the given [`TextMatch`](#textmatch).
229229
<!--Native-->
230230

231231
```js
232-
import { getByText } from 'dom-testing-library'
232+
import { getByText } from '@testing-library/dom'
233233

234234
const container = document.body
235235
const aboutAnchorNode = getByText(container, /about/i)
@@ -238,7 +238,7 @@ const aboutAnchorNode = getByText(container, /about/i)
238238
<!--React-->
239239

240240
```js
241-
import { render } from 'react-testing-library'
241+
import { render } from '@testing-library/react'
242242

243243
const { getByText } = render(<MyComponent />)
244244
const aboutAnchorNode = getByText(/about/i)
@@ -305,7 +305,7 @@ as it's deprecated).
305305
<!--Native-->
306306

307307
```js
308-
import { getByAltText } from 'dom-testing-library'
308+
import { getByAltText } from '@testing-library/dom'
309309

310310
const container = document.body
311311
const incrediblesPosterImg = getByAltText(container, /incredibles.*? poster/i)
@@ -314,7 +314,7 @@ const incrediblesPosterImg = getByAltText(container, /incredibles.*? poster/i)
314314
<!--React-->
315315

316316
```js
317-
import { render } from 'react-testing-library'
317+
import { render } from '@testing-library/react'
318318

319319
const { getByAltText } = render(<MyComponent />)
320320
const incrediblesPosterImg = getByAltText(/incredibles.*? poster/i)
@@ -360,7 +360,7 @@ Will also find a `title` element within an SVG.
360360
<!--Native-->
361361

362362
```js
363-
import { getByTitle } from 'dom-testing-library'
363+
import { getByTitle } from '@testing-library/dom'
364364

365365
const container = document.body
366366
const deleteElement = getByTitle(container, 'Delete')
@@ -370,7 +370,7 @@ const closeElement = getByTitle(container, 'Close')
370370
<!--React-->
371371

372372
```js
373-
import { render } from 'react-testing-library'
373+
import { render } from '@testing-library/react'
374374

375375
const { getByTitle } = render(<MyComponent />)
376376
const deleteElement = getByTitle('Delete')
@@ -419,7 +419,7 @@ document.getElementById('lastName').value = 'Norris'
419419
<!--Native-->
420420

421421
```js
422-
import { getByDisplayValue } from 'dom-testing-library'
422+
import { getByDisplayValue } from '@testing-library/dom'
423423

424424
const container = document.body
425425
const lastNameInput = getByDisplayValue(container, 'Norris')
@@ -428,7 +428,7 @@ const lastNameInput = getByDisplayValue(container, 'Norris')
428428
<!--React-->
429429

430430
```js
431-
import { render } from 'react-testing-library'
431+
import { render } from '@testing-library/react'
432432

433433
const { getByDisplayValue } = render(<MyComponent />)
434434
const lastNameInput = getByDisplayValue('Norris')
@@ -457,7 +457,7 @@ document.getElementById('messageTextArea').value = 'Hello World'
457457
<!--Native-->
458458

459459
```js
460-
import { getByDisplayValue } from 'dom-testing-library'
460+
import { getByDisplayValue } from '@testing-library/dom'
461461

462462
const container = document.body
463463
const messageTextArea = getByDisplayValue(container, 'Hello World')
@@ -466,7 +466,7 @@ const messageTextArea = getByDisplayValue(container, 'Hello World')
466466
<!--React-->
467467

468468
```js
469-
import { render } from 'react-testing-library'
469+
import { render } from '@testing-library/react'
470470

471471
const { getByDisplayValue } = render(<MyComponent />)
472472
const messageTextArea = getByDisplayValue('Hello World')
@@ -499,7 +499,7 @@ matches the given [`TextMatch`](#textmatch).
499499
<!--Native-->
500500

501501
```js
502-
import { getByDisplayValue } from 'dom-testing-library'
502+
import { getByDisplayValue } from '@testing-library/dom'
503503

504504
const container = document.body
505505
const selectElement = getByDisplayValue(container, 'Alaska')
@@ -508,7 +508,7 @@ const selectElement = getByDisplayValue(container, 'Alaska')
508508
<!--React-->
509509

510510
```js
511-
import { render } from 'react-testing-library'
511+
import { render } from '@testing-library/react'
512512

513513
const { getByDisplayValue } = render(<MyComponent />)
514514
const selectElement = getByDisplayValue('Alaska')
@@ -549,7 +549,7 @@ accepts a [`TextMatch`](#textmatch)).
549549
<!--Native-->
550550

551551
```js
552-
import { getByRole } from 'dom-testing-library'
552+
import { getByRole } from '@testing-library/dom'
553553

554554
const container = document.body
555555
const dialogContainer = getByRole(container, 'dialog')
@@ -558,7 +558,7 @@ const dialogContainer = getByRole(container, 'dialog')
558558
<!--React-->
559559

560560
```js
561-
import { render } from 'react-testing-library'
561+
import { render } from '@testing-library/react'
562562

563563
const { getByRole } = render(<MyComponent />)
564564
const dialogContainer = getByRole('dialog')
@@ -599,7 +599,7 @@ also accepts a [`TextMatch`](#textmatch)).
599599
<!--Native-->
600600

601601
```js
602-
import { getByTestId } from 'dom-testing-library'
602+
import { getByTestId } from '@testing-library/dom'
603603

604604
const container = document.body
605605
const usernameInput = getByTestId(container, 'username-input')
@@ -608,7 +608,7 @@ const usernameInput = getByTestId(container, 'username-input')
608608
<!--React-->
609609

610610
```js
611-
import { render } from 'react-testing-library'
611+
import { render } from '@testing-library/react'
612612

613613
const { getByTestId } = render(<MyComponent />)
614614
const usernameInput = getByTestId('username-input')
@@ -632,7 +632,7 @@ cy.getByTestId('username-input').should('exist')
632632
633633
#### Overriding `data-testid`
634634

635-
The `...ByTestId` functions in `dom-testing-library` use the attribute
635+
The `...ByTestId` functions in `DOM Testing Library` use the attribute
636636
`data-testid` by default, following the precedent set by
637637
[React Native Web](https://github.com/testing-library/react-testing-library/issues/1)
638638
which uses a `testID` prop to emit a `data-testid` attribute on the element, and
@@ -661,7 +661,7 @@ affect the precision of string matching:
661661

662662
### Normalization
663663

664-
Before running any matching logic against text in the DOM, `dom-testing-library`
664+
Before running any matching logic against text in the DOM, `DOM Testing Library`
665665
automatically normalizes that text. By default, normalization consists of
666666
trimming whitespace from the start and end of text, and collapsing multiple
667667
adjacent whitespace characters into a single space.

0 commit comments

Comments
 (0)