diff --git a/docs/svelte-testing-library/faq.mdx b/docs/svelte-testing-library/faq.mdx new file mode 100644 index 000000000..e37c236c7 --- /dev/null +++ b/docs/svelte-testing-library/faq.mdx @@ -0,0 +1,22 @@ +--- +id: faq +title: FAQ +sidebar_label: FAQ +--- + +- [Testing file upload component](#testing-file-upload-component) + +--- + +## Testing file upload component + +File upload handler not triggering? Use `happy-dom`, not `jsdom`, and make +sure to use `fireEvent.change(...)` and not `fireEvent.input(...)`. It seems +that jsdom (which is at v22.1.0 at the time of this writing) doesn't fake all +the File object as it should. + + +See [svelte-testing-library's issue +219](https://github.com/testing-library/svelte-testing-library/issues/219) for +more details. + diff --git a/sidebars.js b/sidebars.js index 1aecc0e0d..7c2ab2190 100755 --- a/sidebars.js +++ b/sidebars.js @@ -161,6 +161,7 @@ module.exports = { 'svelte-testing-library/setup', 'svelte-testing-library/example', 'svelte-testing-library/api', + 'svelte-testing-library/faq', ], }, 'cypress-testing-library/intro',