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

File Input bug when Uploading #1236

Open
cjduncana opened this issue Oct 19, 2024 · 1 comment
Open

File Input bug when Uploading #1236

cjduncana opened this issue Oct 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cjduncana
Copy link

Reproduction example

https://codesandbox.io/p/sandbox/test-file-upload-xtg77s

Prerequisites

  1. Have an input element using the file type with an accept attribute with a comma-separated list that adds spaces between each value.
  2. Write a test that uses the upload function on a file that matches one of the latter values in the accept attribute.

Expected behavior

The file input should have the uploaded file.

Actual behavior

The onChange event is not triggered, and the file input doesn't have the uploaded file.

User-event version

^14.1.1

Environment

No response

Additional context

The problem lies in the isAcceptableFile function. After splitting the string by its commas, it doesn't trim the whitespace, so some valid comma-separated tokens fail this test.

@cjduncana cjduncana added bug Something isn't working needs assessment This needs to be looked at by a team member labels Oct 19, 2024
@cjduncana
Copy link
Author

It's my first time contributing to this project. Once I have time, I can look into how to write an MR following your standards.

@ph-fritsche ph-fritsche removed the needs assessment This needs to be looked at by a team member label Oct 25, 2024
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

2 participants