Skip to content

Commit 402e2b4

Browse files
mcoustimdeschryver
andauthored
fixup: apply suggestions
Co-authored-by: Tim Deschryver <[email protected]>
1 parent b0f2f96 commit 402e2b4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/svelte-testing-library/example.mdx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This basic example demonstrates how to:
1818
- Pass props to your Svelte component using `render`
1919
- Query the structure of your component's DOM elements using `screen`
2020
- Interact with your component using [`@testing-library/user-event`][user-event]
21-
- Make assertions using `expect`, using methods added by
21+
- Make assertions using `expect`, using matchers from
2222
[`@testing-library/jest-dom`][jest-dom]
2323

2424
```html title="greeter.svelte"
@@ -71,9 +71,14 @@ test('greeting appears on click', async () => {
7171

7272
## Events
7373

74-
Events can be tested using spy functions, like those provided by
75-
[`vi.fn()`][vi-fn]. Function props are more straightforward to use and test than
76-
events, so consider using them if they make sense for your project.
74+
Events can be tested using spy functions.
75+
If you're using Vitest you can use [`vi.fn()`][vi-fn] to create a spy.
76+
77+
:::info
78+
79+
Consider using function props to make testing events easier.
80+
81+
:::
7782

7883
```html title="button-with-event.svelte"
7984
<button on:click>click me</button>

0 commit comments

Comments
 (0)