Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(svelte-testing-library): add event, slot, binding, context examples #1366

Merged
merged 5 commits into from
Feb 19, 2024

Conversation

mcous
Copy link
Contributor

@mcous mcous commented Feb 10, 2024

Overview

We've got a few tickets over in svelte-testing-library asking for how to test certain things. This PR adds examples for all the open requests:

I've tested these examples and they all seem to be working, but I'm not the world's best speller nor typist, so any help catching typos is very much appreciated!

Change log

Copy link

netlify bot commented Feb 10, 2024

Deploy Preview for testing-library ready!

Name Link
🔨 Latest commit b21b0db
🔍 Latest deploy log https://app.netlify.com/sites/testing-library/deploys/65cbcee6bae4170009ffe56c
😎 Deploy Preview https://deploy-preview-1366--testing-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mcous mcous marked this pull request as ready for review February 12, 2024 14:49
Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!
Not related to the PR, but I think it could also be useful to show how to "register" the jest-dom matchers so they can be used with Vitest.

docs/svelte-testing-library/example.mdx Outdated Show resolved Hide resolved
docs/svelte-testing-library/example.mdx Outdated Show resolved Hide resolved
@mcous
Copy link
Contributor Author

mcous commented Feb 13, 2024

Thanks for the review @timdeschryver! Will incorporate those suggestions.

Not related to the PR, but I think it could also be useful to show how to "register" the jest-dom matchers so they can be used with Vitest.

Those instructions are covered in the setup docs, updated in #1360. Do you think there needs to be an additional callout and/or additional information?

  1. Add a vitest-setup.js file to optionally set up automatic post-test cleanup and @testing-library/jest-dom expect matchers.
import '@testing-library/svelte/vitest'
import '@testing-library/jest-dom/vitest'

mcous and others added 2 commits February 13, 2024 15:18
Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
@timdeschryver
Copy link
Member

@mcous oops I missed that.
It's fine like this, thanks!

@mcous
Copy link
Contributor Author

mcous commented Feb 17, 2024

@yanick if you got a sec, I could use your eyes on this one, too, to close out a big chunk of our backlog

Copy link
Contributor

@yanick yanick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timdeschryver timdeschryver merged commit 334201d into testing-library:main Feb 19, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants