Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix import issues with jest-dom #913

Merged
merged 2 commits into from Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dom-testing-library/example-intro.mdx
Expand Up @@ -17,7 +17,7 @@ import {
waitFor,
} from '@testing-library/dom'
// adds special assertions like toHaveTextContent
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

function getExampleDOM() {
// This is just a raw example of setting up some DOM
Expand Down
2 changes: 1 addition & 1 deletion docs/ecosystem-user-event.mdx
Expand Up @@ -444,7 +444,7 @@ Options:
```jsx
import React from 'react'
import {render, screen} from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
import userEvent from '@testing-library/user-event'

it('should cycle elements in document tab order', () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/example-reach-router.mdx
Expand Up @@ -13,7 +13,7 @@ import {
createMemorySource,
LocationProvider,
} from '@reach/router'
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

const About = () => <div>You are on the about page</div>
const Home = () => <div>You are home</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/example-react-context.mdx
Expand Up @@ -6,7 +6,7 @@ title: React Context
```jsx
import React from 'react'
import {render, screen} from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
import {NameContext, NameProvider, NameConsumer} from '../react-context'

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/example-react-intl.mdx
Expand Up @@ -103,7 +103,7 @@ export {render}

```jsx
import React from 'react'
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
// We're importing from our own created test-utils and not RTL's
import {render, screen, setupTests} from '../test-utils.js'
import {FormattedDate} from 'react-intl'
Expand Down
2 changes: 1 addition & 1 deletion docs/example-react-router.mdx
Expand Up @@ -51,7 +51,7 @@ import {createMemoryHistory} from 'history'
import React from 'react'
import {Router} from 'react-router-dom'

import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

import {App, LocationDisplay} from './app'

Expand Down
2 changes: 1 addition & 1 deletion docs/guide-disappearance.mdx
Expand Up @@ -97,7 +97,7 @@ in the body of the document, or not. This can be more meaningful than asserting
a query result is `null`.

```javascript
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
// use `queryBy` to avoid throwing an error with `getBy`
const submitButton = screen.queryByText('submit')
expect(submitButton).not.toBeInTheDocument()
Expand Down
2 changes: 1 addition & 1 deletion docs/preact-testing-library/example.mdx
Expand Up @@ -32,7 +32,7 @@ function HiddenMessage({children}) {

```jsx
// NOTE: jest-dom adds handy assertions to Jest and it is recommended, but not required.
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

import {h} from 'preact'
import {render, fireEvent} from '@testing-library/preact'
Expand Down
2 changes: 1 addition & 1 deletion docs/react-testing-library/api.mdx
Expand Up @@ -47,7 +47,7 @@ render(<div />)

```jsx
import {render} from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

test('renders a message', () => {
const {container, getByText} = render(<Greeting />)
Expand Down
4 changes: 2 additions & 2 deletions docs/react-testing-library/example-intro.mdx
Expand Up @@ -14,7 +14,7 @@ import React from 'react'
import {rest} from 'msw'
import {setupServer} from 'msw/node'
import {render, fireEvent, waitFor, screen} from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
import Fetch from '../fetch'

const server = setupServer(
Expand Down Expand Up @@ -78,7 +78,7 @@ import {setupServer} from 'msw/node'
import {render, fireEvent, waitFor, screen} from '@testing-library/react'

// add custom jest matchers from jest-dom
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
// the component to test
import Fetch from '../fetch'
```
Expand Down
2 changes: 1 addition & 1 deletion docs/svelte-testing-library/api.mdx
Expand Up @@ -122,7 +122,7 @@ changes.
**Test**

```js
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

import {render, fireEvent} from '@testing-library/svelte'

Expand Down
2 changes: 1 addition & 1 deletion docs/svelte-testing-library/example.mdx
Expand Up @@ -26,7 +26,7 @@ sidebar_label: Example

```js
// NOTE: jest-dom adds handy assertions to Jest and it is recommended, but not required.
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'

import {render, fireEvent} from '@testing-library/svelte'

Expand Down