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

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

Open
ktmud opened this issue Sep 19, 2022 · 2 comments · May be fixed by #1064
Open

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

ktmud opened this issue Sep 19, 2022 · 2 comments · May be fixed by #1064
Labels
bug Something isn't working

Comments

@ktmud
Copy link

ktmud commented Sep 19, 2022

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.

@ktmud ktmud added bug Something isn't working needs assessment This needs to be looked at by a team member labels Sep 19, 2022
@ktmud ktmud changed the title userEvent.upload does not work when accept file types are separated with space userEvent.upload does not work when accept file types are separated with comma space Sep 19, 2022
@ktmud ktmud changed the title userEvent.upload does not work when accept file types are separated with comma space userEvent.upload does not work when accept contains space Sep 19, 2022
@ktmud ktmud changed the title userEvent.upload does not work when accept contains space userEvent.upload does not work when input's accept contains space Sep 19, 2022
@ktmud ktmud changed the title userEvent.upload does not work when input's accept contains space userEvent.upload does not work when input accept contains space Sep 19, 2022
@ktmud ktmud linked a pull request Sep 22, 2022 that will close this issue
3 tasks
@xjamundx
Copy link

This is related, but the spec says the accepts should be case insensitive, but they aren't being treated as such.

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers

A valid case-insensitive filename extension

Looks like the PR for this should address that issue as well.

@ph-fritsche ph-fritsche removed the needs assessment This needs to be looked at by a team member label Nov 1, 2022
@davidhoneyb
Copy link

I have the same issue, any news?

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

Successfully merging a pull request may close this issue.

4 participants