Skip to content

Commit c031ff0

Browse files
newtonrySimenB
authored andcommitted
docs: add comment about 'cleanup' in react-testing-library exam… (#9144)
1 parent 56460f6 commit c031ff0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/TutorialReact.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ import React from 'react';
256256
import {cleanup, fireEvent, render} from '@testing-library/react';
257257
import CheckboxWithLabel from '../CheckboxWithLabel';
258258

259-
// automatically unmount and cleanup DOM after the test is finished.
259+
// Note: running cleanup afterEach is done automatically for you in @testing-library/[email protected] or higher
260+
// unmount and cleanup DOM after the test is finished.
260261
afterEach(cleanup);
261262

262263
it('CheckboxWithLabel changes the text after click', () => {

examples/react-testing-library/__tests__/CheckboxWithLabel-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import React from 'react';
44
import {cleanup, fireEvent, render} from '@testing-library/react';
55
import CheckboxWithLabel from '../CheckboxWithLabel';
66

7-
// automatically unmount and cleanup DOM after the test is finished.
7+
// Note: running cleanup afterEach is done automatically for you in @testing-library/[email protected] or higher
8+
// unmount and cleanup DOM after the test is finished.
89
afterEach(cleanup);
910

1011
it('CheckboxWithLabel changes the text after click', () => {

0 commit comments

Comments
 (0)