testing-library / testing-library/user-event
upload() should support 'webkitdirectory' without 'multiple' being set
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
Problem description
The upload method doesn't support 'webkitdirectory' unless 'multiple' is also set to true. This is not the expected behaviour as selecting a single directory does not require 'multiple' to be set on the input.
Suggested solution
The upload method line 34 .slice(0, input.multiple ? undefined : 1) should be changed to .slice(0, input.multiple || input.webkitdirectory ? undefined : 1).
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the upload method on line 34 and inspect the slice condition described in the issue. Verify that directory selection works without multiple being set while preserving the existing single-file behavior, then run the relevant upload tests if available and confirm the behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, testing-qa
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100