Skip to content

userEvent.upload does not work when input accept contains space #1060

@ktmud

Description

@ktmud

Reproduction example

https://codesandbox.io/s/sad-david-5wel5v?file=/src/App.test.js

Prerequisites

  1. Render an file input where accept was configured with command AND space (, ), e.g.
    <input type="file" accept="image/png, image/jpeg" />
  2. Trigger userEvent.upload(...) on this input with a file type that matches the accept.

Expected behavior

onChange event should be triggered on the input and input.files should be updated.

Actual behavior

Neither input.files is updated nor onChange was fired.

User-event version

14.4.3

Environment

Testing Library framework:

JS framework:

Test environment:

DOM implementation:

Additional context

The accept attribute on file input does accept file types separated by command + space, both in terms of web standard and what browsers can actually handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions