@testing-library/user-event 13.3.0 → 13.5.0

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.
package/README.md CHANGED
@@ -253,6 +253,9 @@ Thanks goes to these people ([emoji key][emojis]):
253
253
  <td align="center"><a href="http://stderr.timfischbach.de"><img src="https://avatars.githubusercontent.com/u/26554?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tim Fischbach</b></sub></a><br /><a href="https://github.com/testing-library/user-event/issues?q=author%3Atf" title="Bug reports">🐛</a></td>
254
254
  <td align="center"><a href="https://github.com/eventualbuddha"><img src="https://avatars.githubusercontent.com/u/1938?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brian Donovan</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=eventualbuddha" title="Code">💻</a></td>
255
255
  <td align="center"><a href="http://www.largetimber.com"><img src="https://avatars.githubusercontent.com/u/10626756?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eric Wang</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=fa93hws" title="Code">💻</a></td>
256
+ <td align="center"><a href="https://github.com/jesperorb"><img src="https://avatars.githubusercontent.com/u/21122051?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jesper Orb</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=jesperorb" title="Code">💻</a></td>
257
+ <td align="center"><a href="https://johannesfischer.github.io/"><img src="https://avatars.githubusercontent.com/u/28100?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Johannes Fischer</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=JohannesFischer" title="Code">💻</a></td>
258
+ <td align="center"><a href="https://github.com/777PolarFox777"><img src="https://avatars.githubusercontent.com/u/19393384?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrew D.</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=777PolarFox777" title="Code">💻</a></td>
256
259
  </tr>
257
260
  </table>
258
261
 
@@ -6,6 +6,8 @@ import { keyboardKey, keyboardOptions } from './types';
6
6
  * Everything else will be interpreted as a typed character - e.g. `a`.
7
7
  * Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
8
8
  * Keeping the key pressed can be written as `{key>}`.
9
+ * When keeping the key pressed you can choose how long (how many keydown and keypress) the key is pressed `{key>3}`.
10
+ * You can then release the key per `{key>3/}` or keep it pressed and continue with the next key.
9
11
  * Modifiers like `{shift}` imply being kept pressed. This can be turned of per `{shift/}`.
10
12
  */
11
13
  export declare function getNextKeyDef(text: string, options: keyboardOptions): {
@@ -13,4 +15,5 @@ export declare function getNextKeyDef(text: string, options: keyboardOptions): {
13
15
  consumedLength: number;
14
16
  releasePrevious: boolean;
15
17
  releaseSelf: boolean;
18
+ repeat: number;
16
19
  };
@@ -4,7 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getNextKeyDef = getNextKeyDef;
7
+ var bracketDict;
7
8
 
9
+ (function (bracketDict) {
10
+ bracketDict["{"] = "}";
11
+ bracketDict["["] = "]";
12
+ })(bracketDict || (bracketDict = {}));
13
+
14
+ var legacyModifiers;
15
+
16
+ (function (legacyModifiers) {
17
+ legacyModifiers["alt"] = "alt";
18
+ legacyModifiers["ctrl"] = "ctrl";
19
+ legacyModifiers["meta"] = "meta";
20
+ legacyModifiers["shift"] = "shift";
21
+ })(legacyModifiers || (legacyModifiers = {}));
22
+
23
+ var legacyKeyMap;
8
24
  /**
9
25
  * Get the next key from keyMap
10
26
  *
@@ -12,98 +28,143 @@ exports.getNextKeyDef = getNextKeyDef;
12
28
  * Everything else will be interpreted as a typed character - e.g. `a`.
13
29
  * Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
14
30
  * Keeping the key pressed can be written as `{key>}`.
31
+ * When keeping the key pressed you can choose how long (how many keydown and keypress) the key is pressed `{key>3}`.
32
+ * You can then release the key per `{key>3/}` or keep it pressed and continue with the next key.
15
33
  * Modifiers like `{shift}` imply being kept pressed. This can be turned of per `{shift/}`.
16
34
  */
17
- function getNextKeyDef(text, options) {
18
- var _text$slice$match;
19
35
 
20
- const startBracket = ['{', '['].includes(text[0]) ? text[0] : '';
21
- const startModifier = startBracket && text[1] === '/' ? '/' : '';
22
- const descriptorStart = startBracket.length + startModifier.length;
23
- const descriptor = startBracket ? text[descriptorStart] === startBracket ? startBracket : (_text$slice$match = text.slice(descriptorStart).match(/^\w+/)) == null ? void 0 : _text$slice$match[0] : text[descriptorStart];
36
+ (function (legacyKeyMap) {
37
+ legacyKeyMap["ctrl"] = "Control";
38
+ legacyKeyMap["del"] = "Delete";
39
+ legacyKeyMap["esc"] = "Escape";
40
+ legacyKeyMap["space"] = " ";
41
+ })(legacyKeyMap || (legacyKeyMap = {}));
24
42
 
25
- if (!descriptor) {
26
- throw new Error(getErrorMessage('key descriptor', text[descriptorStart], text));
27
- }
43
+ function getNextKeyDef(text, options) {
44
+ var _options$keyboardMap$;
45
+
46
+ const {
47
+ type,
48
+ descriptor,
49
+ consumedLength,
50
+ releasePrevious,
51
+ releaseSelf,
52
+ repeat
53
+ } = readNextDescriptor(text);
54
+ const keyDef = (_options$keyboardMap$ = options.keyboardMap.find(def => {
55
+ if (type === '[') {
56
+ var _def$code;
57
+
58
+ return ((_def$code = def.code) == null ? void 0 : _def$code.toLowerCase()) === descriptor.toLowerCase();
59
+ } else if (type === '{') {
60
+ var _def$key;
61
+
62
+ const key = mapLegacyKey(descriptor);
63
+ return ((_def$key = def.key) == null ? void 0 : _def$key.toLowerCase()) === key.toLowerCase();
64
+ }
65
+
66
+ return def.key === descriptor;
67
+ })) != null ? _options$keyboardMap$ : {
68
+ key: 'Unknown',
69
+ code: 'Unknown',
70
+ [type === '[' ? 'code' : 'key']: descriptor
71
+ };
72
+ return {
73
+ keyDef,
74
+ consumedLength,
75
+ releasePrevious,
76
+ releaseSelf,
77
+ repeat
78
+ };
79
+ }
28
80
 
29
- const descriptorEnd = descriptorStart + descriptor.length;
30
- const endModifier = startBracket && descriptor !== startBracket && ['/', '>'].includes(text[descriptorEnd]) ? text[descriptorEnd] : '';
31
- const endBracket = !startBracket || descriptor === startBracket ? '' : startBracket === '{' ? '}' : ']';
81
+ function readNextDescriptor(text) {
82
+ let pos = 0;
83
+ const startBracket = text[pos] in bracketDict ? text[pos] : '';
84
+ pos += startBracket.length; // `foo{{bar` is an escaped char at position 3,
85
+ // but `foo{{{>5}bar` should be treated as `{` pressed down for 5 keydowns.
86
+
87
+ const startBracketRepeated = startBracket ? text.match(new RegExp(`^\\${startBracket}+`))[0].length : 0;
88
+ const isEscapedChar = startBracketRepeated === 2 || startBracket === '{' && startBracketRepeated > 3;
89
+ const type = isEscapedChar ? '' : startBracket;
90
+ return {
91
+ type,
92
+ ...(type === '' ? readPrintableChar(text, pos) : readTag(text, pos, type))
93
+ };
94
+ }
32
95
 
33
- if (endBracket && text[descriptorEnd + endModifier.length] !== endBracket) {
34
- throw new Error(getErrorMessage('closing bracket', text[descriptorEnd + endModifier.length], text));
96
+ function readPrintableChar(text, pos) {
97
+ const descriptor = text[pos];
98
+ assertDescriptor(descriptor, text, pos);
99
+ pos += descriptor.length;
100
+ return {
101
+ consumedLength: pos,
102
+ descriptor,
103
+ releasePrevious: false,
104
+ releaseSelf: true,
105
+ repeat: 1
106
+ };
107
+ }
108
+
109
+ function readTag(text, pos, startBracket) {
110
+ var _text$slice$match, _text$slice$match$, _text$slice$match2;
111
+
112
+ const releasePreviousModifier = text[pos] === '/' ? '/' : '';
113
+ pos += releasePreviousModifier.length;
114
+ const descriptor = (_text$slice$match = text.slice(pos).match(/^\w+/)) == null ? void 0 : _text$slice$match[0];
115
+ assertDescriptor(descriptor, text, pos);
116
+ pos += descriptor.length;
117
+ const repeatModifier = (_text$slice$match$ = (_text$slice$match2 = text.slice(pos).match(/^>\d+/)) == null ? void 0 : _text$slice$match2[0]) != null ? _text$slice$match$ : '';
118
+ pos += repeatModifier.length;
119
+ const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : '';
120
+ pos += releaseSelfModifier.length;
121
+ const expectedEndBracket = bracketDict[startBracket];
122
+ const endBracket = text[pos] === expectedEndBracket ? expectedEndBracket : '';
123
+
124
+ if (!endBracket) {
125
+ throw new Error(getErrorMessage([!repeatModifier && 'repeat modifier', !releaseSelfModifier && 'release modifier', `"${expectedEndBracket}"`].filter(Boolean).join(' or '), text[pos], text));
35
126
  }
36
127
 
37
- const modifiers = {
38
- consumedLength: [startBracket, startModifier, descriptor, endModifier, endBracket].map(c => c.length).reduce((a, b) => a + b),
39
- releasePrevious: startModifier === '/',
40
- releaseSelf: hasReleaseSelf(startBracket, descriptor, endModifier)
128
+ pos += endBracket.length;
129
+ return {
130
+ consumedLength: pos,
131
+ descriptor,
132
+ releasePrevious: !!releasePreviousModifier,
133
+ repeat: repeatModifier ? Math.max(Number(repeatModifier.substr(1)), 1) : 1,
134
+ releaseSelf: hasReleaseSelf(startBracket, descriptor, releaseSelfModifier, repeatModifier)
41
135
  };
136
+ }
42
137
 
43
- if (isPrintableCharacter(startBracket, descriptor)) {
44
- var _options$keyboardMap$;
45
-
46
- return { ...modifiers,
47
- keyDef: (_options$keyboardMap$ = options.keyboardMap.find(k => k.key === descriptor)) != null ? _options$keyboardMap$ : {
48
- key: descriptor,
49
- code: 'Unknown'
50
- }
51
- };
52
- } else if (startBracket === '{') {
53
- var _options$keyboardMap$2;
54
-
55
- const key = mapLegacyKey(descriptor);
56
- return { ...modifiers,
57
- keyDef: (_options$keyboardMap$2 = options.keyboardMap.find(k => {
58
- var _k$key;
59
-
60
- return ((_k$key = k.key) == null ? void 0 : _k$key.toLowerCase()) === key.toLowerCase();
61
- })) != null ? _options$keyboardMap$2 : {
62
- key: descriptor,
63
- code: 'Unknown'
64
- }
65
- };
66
- } else {
67
- var _options$keyboardMap$3;
68
-
69
- return { ...modifiers,
70
- keyDef: (_options$keyboardMap$3 = options.keyboardMap.find(k => {
71
- var _k$code;
72
-
73
- return ((_k$code = k.code) == null ? void 0 : _k$code.toLowerCase()) === descriptor.toLowerCase();
74
- })) != null ? _options$keyboardMap$3 : {
75
- key: 'Unknown',
76
- code: descriptor
77
- }
78
- };
138
+ function assertDescriptor(descriptor, text, pos) {
139
+ if (!descriptor) {
140
+ throw new Error(getErrorMessage('key descriptor', text[pos], text));
79
141
  }
80
142
  }
81
143
 
82
- function hasReleaseSelf(startBracket, descriptor, endModifier) {
83
- if (endModifier === '/' || !startBracket) {
84
- return true;
144
+ function getEnumValue(f, key) {
145
+ return f[key];
146
+ }
147
+
148
+ function hasReleaseSelf(startBracket, descriptor, releaseSelfModifier, repeatModifier) {
149
+ if (releaseSelfModifier) {
150
+ return releaseSelfModifier === '/';
85
151
  }
86
152
 
87
- if (startBracket === '{' && ['alt', 'ctrl', 'meta', 'shift'].includes(descriptor.toLowerCase())) {
153
+ if (repeatModifier) {
88
154
  return false;
89
155
  }
90
156
 
91
- return endModifier !== '>';
157
+ if (startBracket === '{' && getEnumValue(legacyModifiers, descriptor.toLowerCase())) {
158
+ return false;
159
+ }
160
+
161
+ return true;
92
162
  }
93
163
 
94
164
  function mapLegacyKey(descriptor) {
95
- var _ctrl$del$esc$space$d;
96
-
97
- return (_ctrl$del$esc$space$d = {
98
- ctrl: 'Control',
99
- del: 'Delete',
100
- esc: 'Escape',
101
- space: ' '
102
- }[descriptor]) != null ? _ctrl$del$esc$space$d : descriptor;
103
- }
165
+ var _getEnumValue;
104
166
 
105
- function isPrintableCharacter(startBracket, descriptor) {
106
- return !startBracket || startBracket === descriptor || startBracket === '{' && descriptor.length === 1;
167
+ return (_getEnumValue = getEnumValue(legacyKeyMap, descriptor)) != null ? _getEnumValue : descriptor;
107
168
  }
108
169
 
109
170
  function getErrorMessage(expected, found, text) {
@@ -126,6 +126,14 @@ const defaultKeyMap = [// alphanumeric keys
126
126
  code: 'Delete',
127
127
  key: 'Delete',
128
128
  keyCode: 46
129
+ }, {
130
+ code: 'PageUp',
131
+ key: 'PageUp',
132
+ keyCode: 33
133
+ }, {
134
+ code: 'PageDown',
135
+ key: 'PageDown',
136
+ keyCode: 34
129
137
  } // TODO: add mappings
130
138
  ];
131
139
  exports.defaultKeyMap = defaultKeyMap;
@@ -21,6 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
22
 
23
23
  async function keyboardImplementation(text, options, state) {
24
+ var _state$repeatKey;
25
+
24
26
  const {
25
27
  document
26
28
  } = options;
@@ -31,14 +33,16 @@ async function keyboardImplementation(text, options, state) {
31
33
  keyDef,
32
34
  consumedLength,
33
35
  releasePrevious,
34
- releaseSelf
35
- } = (0, _getNextKeyDef.getNextKeyDef)(text, options);
36
+ releaseSelf,
37
+ repeat
38
+ } = (_state$repeatKey = state.repeatKey) != null ? _state$repeatKey : (0, _getNextKeyDef.getNextKeyDef)(text, options);
36
39
  const replace = applyPlugins(plugins.replaceBehavior, keyDef, getCurrentElement(), options, state);
37
40
 
38
41
  if (!replace) {
39
- const pressed = state.pressed.find(p => p.keyDef === keyDef);
42
+ const pressed = state.pressed.find(p => p.keyDef === keyDef); // Release the key automatically if it was pressed before.
43
+ // Do not release the key on iterations on `state.repeatKey`.
40
44
 
41
- if (pressed) {
45
+ if (pressed && !state.repeatKey) {
42
46
  keyup(keyDef, getCurrentElement, options, state, pressed.unpreventedDefault);
43
47
  }
44
48
 
@@ -47,15 +51,29 @@ async function keyboardImplementation(text, options, state) {
47
51
 
48
52
  if (unpreventedDefault && hasKeyPress(keyDef, state)) {
49
53
  keypress(keyDef, getCurrentElement, options, state);
50
- }
54
+ } // Release the key only on the last iteration on `state.repeatKey`.
55
+
51
56
 
52
- if (releaseSelf) {
57
+ if (releaseSelf && repeat <= 1) {
53
58
  keyup(keyDef, getCurrentElement, options, state, unpreventedDefault);
54
59
  }
55
60
  }
56
61
  }
57
62
 
58
- if (text.length > consumedLength) {
63
+ if (repeat > 1) {
64
+ state.repeatKey = {
65
+ // don't consume again on the next iteration
66
+ consumedLength: 0,
67
+ keyDef,
68
+ releasePrevious,
69
+ releaseSelf,
70
+ repeat: repeat - 1
71
+ };
72
+ } else {
73
+ delete state.repeatKey;
74
+ }
75
+
76
+ if (text.length > consumedLength || repeat > 1) {
59
77
  if (options.delay > 0) {
60
78
  await (0, _utils.wait)(options.delay);
61
79
  }
@@ -28,6 +28,21 @@ const keydownBehavior = [{
28
28
  (0, _utils.setSelectionRange)(element, newPos, newPos);
29
29
  }
30
30
  }
31
+ }, {
32
+ matches: (keyDef, element) => (keyDef.key === 'PageUp' || keyDef.key === 'PageDown') && (0, _utils.isElementType)(element, ['input']),
33
+ handle: (keyDef, element) => {
34
+ // This could probably been improved by collapsing a selection range
35
+ if (keyDef.key === 'PageUp') {
36
+ (0, _utils.setSelectionRange)(element, 0, 0);
37
+ } else {
38
+ var _getValue$length2, _getValue2;
39
+
40
+ const newPos = (_getValue$length2 = (_getValue2 = (0, _utils.getValue)(element)) == null ? void 0 : _getValue2.length) != null ? _getValue$length2 :
41
+ /* istanbul ignore next */
42
+ 0;
43
+ (0, _utils.setSelectionRange)(element, newPos, newPos);
44
+ }
45
+ }
31
46
  }, {
32
47
  matches: (keyDef, element) => keyDef.key === 'Delete' && (0, _utils.isEditable)(element) && !(0, _utils.isCursorAtEnd)(element),
33
48
  handle: (keDef, element, options, state) => {
@@ -71,6 +71,15 @@ const keydownBehavior = [{
71
71
  }];
72
72
  exports.keydownBehavior = keydownBehavior;
73
73
  const keypressBehavior = [{
74
+ matches: (keyDef, element) => keyDef.key === 'Enter' && (0, _utils.isElementType)(element, 'input') && ['checkbox', 'radio'].includes(element.type),
75
+ handle: (keyDef, element) => {
76
+ const form = element.form;
77
+
78
+ if ((0, _utils.hasFormSubmit)(form)) {
79
+ _dom.fireEvent.submit(form);
80
+ }
81
+ }
82
+ }, {
74
83
  matches: (keyDef, element) => keyDef.key === 'Enter' && ((0, _utils.isClickableInput)(element) || // Links with href defined should handle Enter the same as a click
75
84
  (0, _utils.isElementType)(element, 'a') && Boolean(element.href)),
76
85
  handle: (keyDef, element, options, state) => {
@@ -81,7 +90,7 @@ const keypressBehavior = [{
81
90
  handle: (keyDef, element) => {
82
91
  const form = element.form;
83
92
 
84
- if (form && (form.querySelectorAll('input').length === 1 || form.querySelector('input[type="submit"]') || form.querySelector('button[type="submit"]'))) {
93
+ if (form && (form.querySelectorAll('input').length === 1 || (0, _utils.hasFormSubmit)(form))) {
85
94
  _dom.fireEvent.submit(form);
86
95
  }
87
96
  }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @deprecated This list of strings with special meaning is no longer necessary
3
+ * as we've introduced a standardized way to describe any keystroke for `userEvent`.
4
+ * @see https://testing-library.com/docs/ecosystem-user-event#keyboardtext-options
5
+ */
1
6
  export declare const specialCharMap: {
2
7
  readonly arrowLeft: "{arrowleft}";
3
8
  readonly arrowRight: "{arrowright}";
@@ -12,4 +17,6 @@ export declare const specialCharMap: {
12
17
  readonly selectAll: "{selectall}";
13
18
  readonly space: "{space}";
14
19
  readonly whitespace: " ";
20
+ readonly pageUp: "{pageUp}";
21
+ readonly pageDown: "{pageDown}";
15
22
  };
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.specialCharMap = void 0;
7
+
8
+ /**
9
+ * @deprecated This list of strings with special meaning is no longer necessary
10
+ * as we've introduced a standardized way to describe any keystroke for `userEvent`.
11
+ * @see https://testing-library.com/docs/ecosystem-user-event#keyboardtext-options
12
+ */
7
13
  const specialCharMap = {
8
14
  arrowLeft: '{arrowleft}',
9
15
  arrowRight: '{arrowright}',
@@ -17,6 +23,8 @@ const specialCharMap = {
17
23
  end: '{end}',
18
24
  selectAll: '{selectall}',
19
25
  space: '{space}',
20
- whitespace: ' '
26
+ whitespace: ' ',
27
+ pageUp: '{pageUp}',
28
+ pageDown: '{pageDown}'
21
29
  };
22
30
  exports.specialCharMap = specialCharMap;
@@ -1,3 +1,4 @@
1
+ import { getNextKeyDef } from './getNextKeyDef';
1
2
  /**
2
3
  * @internal Do not create/alter this by yourself as this type might be subject to changes.
3
4
  */
@@ -35,6 +36,10 @@ export declare type keyboardState = {
35
36
  E.g. ^1
36
37
  */
37
38
  carryChar: string;
39
+ /**
40
+ Repeat keydown and keypress event
41
+ */
42
+ repeatKey?: ReturnType<typeof getNextKeyDef>;
38
43
  };
39
44
  export declare type keyboardOptions = {
40
45
  /** Document in which to perform the events */
@@ -22,3 +22,4 @@ export * from './misc/isDisabled';
22
22
  export * from './misc/isDocument';
23
23
  export * from './misc/wait';
24
24
  export * from './misc/hasPointerEvents';
25
+ export * from './misc/hasFormSubmit';
@@ -314,4 +314,17 @@ Object.keys(_hasPointerEvents).forEach(function (key) {
314
314
  return _hasPointerEvents[key];
315
315
  }
316
316
  });
317
+ });
318
+
319
+ var _hasFormSubmit = require("./misc/hasFormSubmit");
320
+
321
+ Object.keys(_hasFormSubmit).forEach(function (key) {
322
+ if (key === "default" || key === "__esModule") return;
323
+ if (key in exports && exports[key] === _hasFormSubmit[key]) return;
324
+ Object.defineProperty(exports, key, {
325
+ enumerable: true,
326
+ get: function () {
327
+ return _hasFormSubmit[key];
328
+ }
329
+ });
317
330
  });
@@ -0,0 +1 @@
1
+ export declare const hasFormSubmit: (form: HTMLFormElement | null) => form is HTMLFormElement;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hasFormSubmit = void 0;
7
+
8
+ const hasFormSubmit = form => !!(form && (form.querySelector('input[type="submit"]') || form.querySelector('button[type="submit"]')));
9
+
10
+ exports.hasFormSubmit = hasFormSubmit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/user-event",
3
- "version": "13.3.0",
3
+ "version": "13.5.0",
4
4
  "description": "Fire events the same way the user does",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [