Skip to content

Commit c0d82b9

Browse files
committed
Document testing cleanup
1 parent 9293f4a commit c0d82b9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎src/content/warnings/react-dom-test-utils.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {render} from '@testing-library/react';
4343

4444
render(<Component />);
4545
```
46+
4647
`render` returns an `unmount` function and the rendered container:
4748

4849
```js
@@ -54,6 +55,7 @@ expect(container.innerHTML).toBe('');
5455

5556
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.
5657

58+
``
5759
### ReactDOMTestUtils.Simulate {/*reactdomtestutilssimulate*/}
5860

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

0 commit comments

Comments
 (0)