diff --git a/src/components/MDX/SimpleCallout.tsx b/src/components/MDX/SimpleCallout.tsx index 0e124baa743..2560aed2376 100644 --- a/src/components/MDX/SimpleCallout.tsx +++ b/src/components/MDX/SimpleCallout.tsx @@ -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; @@ -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 )}> -

{title} -

+ {children} ); diff --git a/src/content/warnings/react-dom-test-utils.md b/src/content/warnings/react-dom-test-utils.md index 794bb1d11f4..0c5b5d4fc8d 100644 --- a/src/content/warnings/react-dom-test-utils.md +++ b/src/content/warnings/react-dom-test-utils.md @@ -44,7 +44,19 @@ import {render} from '@testing-library/react'; render(); ``` -### ReactDOMTestUtils.Simulate {/*reactdomtestutilssimulate*/} +`render` returns an `unmount` function and the rendered container: + +```js +const {unmount, container} = render(); + +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`.