-
Couldn't load subscription status.
- Fork 255
Description
@testing-library/user-eventversion: 12.8.1
- Testing Framework and version: jest 26
- DOM Environment: jsdom 16.4.0
Sample code that breaks:
user.upload(fileChooser, new File([validInputFile], 'test.txt'));
await waitFor(() =>
expect(logicThatTriggersOnChange).toBeCalled(),
);
user.upload(fileChooser, []);
// this no longer succeeds.
await waitFor(() =>
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.
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.