Skip to content

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

Description

@bryan-codaio

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions