@testing-library/user-event 12.6.1 → 12.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/upload.js +2 -10
  2. package/package.json +1 -1
package/dist/upload.js CHANGED
@@ -15,17 +15,9 @@ var _focus = require("./focus");
15
15
 
16
16
  function upload(element, fileOrFiles, init) {
17
17
  if (element.disabled) return;
18
- let files;
19
- let input = element;
20
18
  (0, _click.click)(element, init);
21
-
22
- if (element.tagName === 'LABEL') {
23
- files = element.control.multiple ? fileOrFiles : [fileOrFiles];
24
- input = element.control;
25
- } else {
26
- files = element.multiple ? fileOrFiles : [fileOrFiles];
27
- } // blur fires when the file selector pops up
28
-
19
+ const input = element.tagName === 'LABEL' ? element.control : element;
20
+ const files = (Array.isArray(fileOrFiles) ? fileOrFiles : [fileOrFiles]).slice(0, input.multiple ? undefined : 1); // blur fires when the file selector pops up
29
21
 
30
22
  (0, _blur.blur)(element, init); // focus fires when they make their selection
31
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/user-event",
3
- "version": "12.6.1",
3
+ "version": "12.6.2",
4
4
  "description": "Fire events the same way the user does",
5
5
  "main": "dist/index.js",
6
6
  "typings": "typings/index.d.ts",