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

Passing string to userEvent.paste() uses invalid MIME type "text" instead of "text/plain" #1269

Open
bryan-codaio opened this issue Jan 30, 2025 · 0 comments
Labels
bug Something isn't working needs assessment This needs to be looked at by a team member

Comments

@bryan-codaio
Copy link
Contributor

Reproduction example

https://codesandbox.io/p/sandbox/broken-rain-qdq5hs

Prerequisites

  1. call .paste() with a string
  2. observe that the clipboard data stub created with this string info has type text

Expected behavior

Expected is that e.clipboardData.types.includes('text/plain') would return true, and e.clipboardData.getData('text/plain') would give me back the string initially passed to .paste()

Actual behavior

e.clipboardData.getData('text/plain') doesn't give anything back (and I don't want to be calling e.clipboardData.getData('text') since I don't think that's an accurate/realistic mime type)

User-event version

14.5.2

Environment

N/A (given I provided a working codesandbox above?)

Additional context

The 'text' MIME type comes from

dt.setData('text', text)

@bryan-codaio bryan-codaio added bug Something isn't working needs assessment This needs to be looked at by a team member labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs assessment This needs to be looked at by a team member
Projects
None yet
Development

No branches or pull requests

1 participant