testing-library / testing-library-docs

docs site for @testing-library/*
https://testing-library.com
MIT License
451 stars 701 forks source link

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

Closed mcous closed 6 months ago

mcous commented 7 months ago

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

netlify[bot] commented 7 months ago

Deploy Preview for testing-library ready!

Name Link
Latest commit b21b0db479cd556c0e0b76fe51d39702110c329f
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 commented 7 months ago

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'
timdeschryver commented 7 months ago

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

mcous commented 6 months ago

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