Behaviour of uploading the same file twice with user.upload #1241
tw-thoughtworks-simon-tang
started this conversation in
General
Replies: 2 comments
-
Closing since I should've made this an issue report |
Beta Was this translation helpful? Give feedback.
0 replies
-
Reopening because I don't have time to make a live codebox and fill out the issue report |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just want to share a use case where I think that
user.upload
deviates from the actual browser behaviour, and this difference seems to prevent me from writing a test case to cover a recent bugfix in my code.I'm building a component that uses a hidden
<input type="file">
to trigger the browser file picker. I made a bugfix where I addedinput.value = ""
after handling the file selection event, to enable the user to upload the same file multiple times. Without this line, the same file selected twice would not trigger repeat events since it was already in theFileList
.However, I couldn't use
user.upload
in my tests to recreate the condition for this test. I'm assumingsetFiles
would need to be rewritten to reflect the browser behaviour where a duplicate file upload doesn't trigger a second event.Curious what your thoughts are on this and whether it sounds like
user.upload
should take into account existing uploaded files?Beta Was this translation helpful? Give feedback.
All reactions