You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user.upload(fileChooser,newFile([validInputFile],'test.txt'));awaitwaitFor(()=>expect(logicThatTriggersOnChange).toBeCalled(),);user.upload(fileChooser,[]);// this no longer succeeds.awaitwaitFor(()=>expect(logicThatTriggersOnChange).toBeCalled(),);
Problem description:
12.8.1 no longer fires an event when triggering upload with an empty file list. This means I can't simulate the user interaction "user opens file dialog, then aborts without selecting a file" anymore.
... but my tests on both Firefox and Chrome show that they do fire an event (and go back to "no file selected") when a file was selected previously and then the upload dialog is opened again and aborted afterwards.
Suggested solution:
Reintroduce firing an "empty" event.
The text was updated successfully, but these errors were encountered:
Thanks a lot for this report. Looks like our investigation on this matter was not thorough enough.
The browser does not fire an input event when the file dialog is closed at first.
But looks like us fixing one bug introduced another here:
It seems it does not matter if a user closes the file dialog, but if his selection changes the value of the file input.
When selecting the same file(s) - regardless of the selection being multiple, single or none - no input event is fired.
Aborting the selection clears an already existing FilesList and triggers an input event.
@testing-library/user-event
version: 12.8.1Sample code that breaks:
Problem description:
12.8.1 no longer fires an event when triggering
upload
with an empty file list. This means I can't simulate the user interaction "user opens file dialog, then aborts without selecting a file" anymore.Probably caused by https://github.com/testing-library/user-event/pull/562/files#diff-0d02b9dbce9a4eb9b8e939cd4606e84f9348a9a289903a87636ecc6ad25ad413R22 in #562
The PR in question explicitly tests this behaviour and wants no event to be fired: https://github.com/testing-library/user-event/pull/562/files#diff-96272a98d39b469bbb095ed9a8be60a76ff04515be29afad4cdc45814d640d1eR195
... but my tests on both Firefox and Chrome show that they do fire an event (and go back to "no file selected") when a file was selected previously and then the upload dialog is opened again and aborted afterwards.
Suggested solution:
Reintroduce firing an "empty" event.
The text was updated successfully, but these errors were encountered: