Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/MDX/SimpleCallout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import * as React from 'react';
import cn from 'classnames';
import {H3} from './Heading';
import {H2} from './Heading';

interface SimpleCalloutProps {
title: string;
Expand All @@ -25,11 +25,11 @@ function SimpleCallout({title, children, className}: SimpleCalloutProps) {
'p-6 xl:p-8 pb-4 xl:pb-6 bg-card dark:bg-card-dark rounded-2xl shadow-inner-border dark:shadow-inner-border-dark text-base text-secondary dark:text-secondary-dark my-8',
className
)}>
<H3
<H2
className="text-primary dark:text-primary-dark mt-0 mb-3 leading-tight"
isPageAnchor={false}>
{title}
</H3>
</H2>
{children}
</div>
);
Expand Down
14 changes: 13 additions & 1 deletion src/content/warnings/react-dom-test-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ import {render} from '@testing-library/react';
render(<Component />);
```

### ReactDOMTestUtils.Simulate {/*reactdomtestutilssimulate*/}
`render` returns an `unmount` function and the rendered container:

```js
const {unmount, container} = render(<Component />);

unmount();
expect(container.innerHTML).toBe('');
```

React Testing Library automatically cleans up rendered trees after each test when your test framework provides an `afterEach` hook. You can call `unmount` yourself when you need to verify cleanup during a test. Unmounting a tree also removes content rendered into a portal by that tree. If your test creates a separate React root, unmount that root separately.

```
### ReactDOMTestUtils.Simulate {/*reactdomtestutilssimulate*/}

`Simulate` can be replaced with `fireEvent` from `@testing-library/react`.

Expand Down
Loading
⌂ Proxy