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

@testing-library/user-event paste() method fails when using happy-dom, works with jsdom #1077

Closed
sethreidnz opened this issue Sep 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@sethreidnz
Copy link

sethreidnz commented Sep 18, 2023

Describe the bug

When switching to happy-dom I noticed this bug started occuring with @testing-libary. I'm not 100% certain which side the fix needs to be on but it works with jestdom. I will also raise a bug over there

TypeError: dt.setData is not a function
 ❯ getClipboardDataFromString node_modules/@testing-library/user-event/dist/esm/clipboard/paste.js:25:8
 ❯ Object.paste node_modules/@testing-library/user-event/dist/esm/clipboard/paste.js:16:70
 ❯ node_modules/@testing-library/user-event/dist/esm/setup/setup.js:84:35
 ❯ Object.asyncWrapper node_modules/@testing-library/react/dist/pure.js:73:28
 ❯ wrapAsync node_modules/@testing-library/user-event/dist/esm/setup/wrapAsync.js:7:24
 ❯ Object.method [as paste] node_modules/@testing-library/user-event/dist/esm/setup/setup.js:84

To Reproduce
Steps to reproduce the behavior:

  1. Setup a new project using happy-dom and @testing-library/user-event
  2. Create a test that uses the user.paste() api
  3. Run tests and see error

See reproduction repo here for full example

Expected behavior

Expect the .paste() function to work as it does in jestdom

Device:

  • OS: MacOS
  • Browser: Using Vitest
  • Version: 12.1.2

Additional context

See reproduction repo here for full example

I have also raised an issue with @testing-libary

testing-library/user-event#1167

@jrubins
Copy link

jrubins commented Oct 10, 2023

Ran into the same issue. Looking at the repo commits, it seems like support for this was added last week (but not yet released). See 243676f. 🤞 this lands in a release soon!

@jrubins
Copy link

jrubins commented Oct 11, 2023

Oh, @sethreidnz , seems like this was released in https://github.com/capricorn86/happy-dom/releases/tag/v12.8.0. Updating to the latest version fixed this issue for me.

@capricorn86
Copy link
Owner

It seems like this has been fixed, so I will close the issue. Please re-open if it is not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants