Skip to content

Commit 7f2ed47

Browse files
authored
Update userEvent.setup with minimal and annotated versions
1 parent 0a54b10 commit 7f2ed47

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/react-testing-library/example-intro.mdx

+8-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ test('loads and displays greeting', async () => {
4949

5050
// Apply workarounds and mock the UI layer to simulate user interactions
5151
// like they would happen in the browser
52-
const setup = (jsx)=> ({ user: userEvent.setup(), ...render(jsx) })
52+
function setup(jsx) {
53+
return {
54+
// create a user-event instance
55+
user: userEvent.setup(),
56+
// render a React element
57+
...render(jsx),
58+
}
59+
}
5360

5461
test('loads and displays greeting', async () => {
5562

0 commit comments

Comments
 (0)