@testing-library/user-event 12.4.0 → 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.
package/README.md CHANGED
@@ -47,6 +47,7 @@ change the state of the checkbox.
47
47
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
48
48
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
49
49
 
50
+
50
51
  - [Installation](#installation)
51
52
  - [API](#api)
52
53
  - [`click(element, eventInit, options)`](#clickelement-eventinit-options)
@@ -60,6 +61,7 @@ change the state of the checkbox.
60
61
  - [`hover(element)`](#hoverelement)
61
62
  - [`unhover(element)`](#unhoverelement)
62
63
  - [`paste(element, text, eventInit, options)`](#pasteelement-text-eventinit-options)
64
+ - [`specialChars`](#specialchars)
63
65
  - [Issues](#issues)
64
66
  - [🐛 Bugs](#-bugs)
65
67
  - [💡 Feature Requests](#-feature-requests)
@@ -118,7 +120,7 @@ test('click', () => {
118
120
  )
119
121
 
120
122
  userEvent.click(screen.getByText('Check'))
121
- expect(screen.getByLabelText('Check')).toHaveAttribute('checked', true)
123
+ expect(screen.getByLabelText('Check')).toBeChecked()
122
124
  })
123
125
  ```
124
126
 
@@ -147,8 +149,8 @@ import userEvent from '@testing-library/user-event'
147
149
 
148
150
  test('double click', () => {
149
151
  const onChange = jest.fn()
150
- render(<input type="checkbox" id="checkbox" onChange={onChange} />)
151
- const checkbox = screen.getByTestId('checkbox')
152
+ render(<input type="checkbox" onChange={onChange} />)
153
+ const checkbox = screen.getByRole('checkbox')
152
154
  userEvent.dblClick(checkbox)
153
155
  expect(onChange).toHaveBeenCalledTimes(2)
154
156
  expect(checkbox).not.toBeChecked()
@@ -198,11 +200,13 @@ The following special character strings are supported:
198
200
  | `{selectall}` | N/A | N/A | Selects all the text of the element. Note that this will only work for elements that support selection ranges (so, not `email`, `password`, `number`, among others) |
199
201
  | `{arrowleft}` | ArrowLeft | N/A | |
200
202
  | `{arrowright}` | ArrowRight | N/A | |
203
+ | `{arrowup}` | ArrowUp | N/A | |
204
+ | `{arrowdown}` | ArrowDown | N/A | |
201
205
  | `{shift}` | Shift | `shiftKey` | Does **not** capitalize following characters. |
202
206
  | `{ctrl}` | Control | `ctrlKey` | |
203
207
  | `{alt}` | Alt | `altKey` | |
204
208
  | `{meta}` | OS | `metaKey` | |
205
- | `{capslock}` | CapsLock | `modifierCapsLock` | Fires both keydown and keyup when used (simulates a user clicking their "Caps Lock" button to enable caps lock). |
209
+ | `{capslock}` | CapsLock | `modifierCapsLock` | Fires both keydown and keyup when used (simulates a user clicking their "Caps Lock" button to enable caps lock). |
206
210
 
207
211
  > **A note about modifiers:** Modifier keys (`{shift}`, `{ctrl}`, `{alt}`,
208
212
  > `{meta}`) will activate their corresponding event modifiers for the duration
@@ -517,6 +521,47 @@ test('should paste text in input', () => {
517
521
  You can use the `eventInit` if what you're pasting should have `clipboardData`
518
522
  (like `files`).
519
523
 
524
+ ### `specialChars`
525
+
526
+ A handful set of special characters used in [type](#typeelement-text-options)
527
+ method.
528
+
529
+ | Key | Character |
530
+ | ---------- | -------------- |
531
+ | arrowLeft | `{arrowleft}` |
532
+ | arrowRight | `{arrowright}` |
533
+ | arrowDown | `{arrowdown}` |
534
+ | arrowUp | `{arrowup}` |
535
+ | enter | `{enter}` |
536
+ | escape | `{esc}` |
537
+ | delete | `{del}` |
538
+ | backspace | `{backspace}` |
539
+ | selectAll | `{selectall}` |
540
+ | space | `{space}` |
541
+ | whitespace | `' '` |
542
+
543
+ Usage example:
544
+
545
+ ```jsx
546
+ import React from 'react'
547
+ import {render, screen} from '@testing-library/react'
548
+ import userEvent, {specialChars} from '@testing-library/user-event'
549
+
550
+ test('delete characters within the selectedRange', () => {
551
+ render(
552
+ <div>
553
+ <label htmlFor="my-input">Example:</label>
554
+ <input id="my-input" type="text" value="This is a bad example" />
555
+ </div>,
556
+ )
557
+ const input = screen.getByLabelText(/example/i)
558
+ input.setSelectionRange(10, 13)
559
+ userEvent.type(input, `${specialChars.backspace}good`)
560
+
561
+ expect(input).toHaveValue('This is a good example')
562
+ })
563
+ ```
564
+
520
565
  ## Issues
521
566
 
522
567
  _Looking to contribute? Look for the [Good First Issue][good-first-issue]
@@ -595,7 +640,7 @@ Thanks goes to these people ([emoji key][emojis]):
595
640
  <td align="center"><a href="https://github.com/nanivijay"><img src="https://avatars0.githubusercontent.com/u/5945591?v=4" width="100px;" alt=""/><br /><sub><b>Vijay Kumar Otti</b></sub></a><br /><a href="https://github.com/testing-library/user-event/issues?q=author%3Ananivijay" title="Bug reports">🐛</a></td>
596
641
  <td align="center"><a href="http://tompicton.com"><img src="https://avatars2.githubusercontent.com/u/12588098?v=4" width="100px;" alt=""/><br /><sub><b>Tom Picton</b></sub></a><br /><a href="https://github.com/testing-library/user-event/issues?q=author%3Atpict" title="Bug reports">🐛</a> <a href="https://github.com/testing-library/user-event/commits?author=tpict" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=tpict" title="Tests">⚠️</a></td>
597
642
  <td align="center"><a href="https://hung.dev"><img src="https://avatars3.githubusercontent.com/u/8603085?v=4" width="100px;" alt=""/><br /><sub><b>Hung Viet Nguyen</b></sub></a><br /><a href="https://github.com/testing-library/user-event/issues?q=author%3Anvh95" title="Bug reports">🐛</a></td>
598
- <td align="center"><a href="https://nickmccurdy.com/"><img src="https://avatars0.githubusercontent.com/u/927220?v=4" width="100px;" alt=""/><br /><sub><b>Nick McCurdy</b></sub></a><br /><a href="#projectManagement-nickmccurdy" title="Project Management">📆</a> <a href="#question-nickmccurdy" title="Answering Questions">💬</a> <a href="https://github.com/testing-library/user-event/commits?author=nickmccurdy" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=nickmccurdy" title="Tests">⚠️</a></td>
643
+ <td align="center"><a href="https://nickmccurdy.com/"><img src="https://avatars0.githubusercontent.com/u/927220?v=4" width="100px;" alt=""/><br /><sub><b>Nick McCurdy</b></sub></a><br /><a href="#projectManagement-nickmccurdy" title="Project Management">📆</a> <a href="#question-nickmccurdy" title="Answering Questions">💬</a> <a href="https://github.com/testing-library/user-event/commits?author=nickmccurdy" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=nickmccurdy" title="Tests">⚠️</a> <a href="https://github.com/testing-library/user-event/commits?author=nickmccurdy" title="Documentation">📖</a></td>
599
644
  </tr>
600
645
  <tr>
601
646
  <td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt=""/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=timdeschryver" title="Tests">⚠️</a></td>
@@ -633,6 +678,10 @@ Thanks goes to these people ([emoji key][emojis]):
633
678
  <td align="center"><a href="https://github.com/Sonic12040"><img src="https://avatars3.githubusercontent.com/u/21055893?v=4" width="100px;" alt=""/><br /><sub><b>Sonic12040</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=Sonic12040" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=Sonic12040" title="Tests">⚠️</a> <a href="https://github.com/testing-library/user-event/commits?author=Sonic12040" title="Documentation">📖</a></td>
634
679
  <td align="center"><a href="https://github.com/gndelia"><img src="https://avatars1.githubusercontent.com/u/352474?v=4" width="100px;" alt=""/><br /><sub><b>Gonzalo D'Elia</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=gndelia" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=gndelia" title="Tests">⚠️</a> <a href="https://github.com/testing-library/user-event/commits?author=gndelia" title="Documentation">📖</a></td>
635
680
  </tr>
681
+ <tr>
682
+ <td align="center"><a href="https://github.com/vasilii-kovalev"><img src="https://avatars0.githubusercontent.com/u/10310491?v=4" width="100px;" alt=""/><br /><sub><b>Vasilii Kovalev</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=vasilii-kovalev" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=vasilii-kovalev" title="Documentation">📖</a></td>
683
+ <td align="center"><a href="https://www.daleseo.com"><img src="https://avatars1.githubusercontent.com/u/5466341?v=4" width="100px;" alt=""/><br /><sub><b>Dale Seo</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=daleseo" title="Documentation">📖</a></td>
684
+ </tr>
636
685
  </table>
637
686
 
638
687
  <!-- markdownlint-enable -->
package/dist/index.js CHANGED
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "specialChars", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _type.specialCharMap;
10
+ }
11
+ });
6
12
  exports.default = void 0;
7
13
 
8
14
  var _click = require("./click");
@@ -35,59 +35,78 @@ function selectOptionsBase(newValue, select, values, init) {
35
35
  }).filter(option => !option.disabled);
36
36
  if (select.disabled || !selectedOptions.length) return;
37
37
 
38
- if (select.multiple) {
39
- for (const option of selectedOptions) {
40
- // events fired for multiple select are weird. Can't use hover...
41
- _dom.fireEvent.pointerOver(option, init);
38
+ if (select instanceof HTMLSelectElement) {
39
+ if (select.multiple) {
40
+ for (const option of selectedOptions) {
41
+ // events fired for multiple select are weird. Can't use hover...
42
+ _dom.fireEvent.pointerOver(option, init);
42
43
 
43
- _dom.fireEvent.pointerEnter(select, init);
44
+ _dom.fireEvent.pointerEnter(select, init);
44
45
 
45
- _dom.fireEvent.mouseOver(option);
46
+ _dom.fireEvent.mouseOver(option);
46
47
 
47
- _dom.fireEvent.mouseEnter(select);
48
+ _dom.fireEvent.mouseEnter(select);
49
+
50
+ _dom.fireEvent.pointerMove(option, init);
48
51
 
49
- _dom.fireEvent.pointerMove(option, init);
52
+ _dom.fireEvent.mouseMove(option, init);
50
53
 
51
- _dom.fireEvent.mouseMove(option, init);
54
+ _dom.fireEvent.pointerDown(option, init);
52
55
 
53
- _dom.fireEvent.pointerDown(option, init);
56
+ _dom.fireEvent.mouseDown(option, init);
54
57
 
55
- _dom.fireEvent.mouseDown(option, init);
58
+ (0, _focus.focus)(select, init);
56
59
 
57
- (0, _focus.focus)(select, init);
60
+ _dom.fireEvent.pointerUp(option, init);
58
61
 
59
- _dom.fireEvent.pointerUp(option, init);
62
+ _dom.fireEvent.mouseUp(option, init);
63
+
64
+ selectOption(option);
65
+
66
+ _dom.fireEvent.click(option, init);
67
+ }
68
+ } else if (selectedOptions.length === 1) {
69
+ // the click to open the select options
70
+ (0, _click.click)(select, init);
71
+ selectOption(selectedOptions[0]); // the browser triggers another click event on the select for the click on the option
72
+ // this second click has no 'down' phase
60
73
 
61
- _dom.fireEvent.mouseUp(option, init);
74
+ _dom.fireEvent.pointerOver(select, init);
75
+
76
+ _dom.fireEvent.pointerEnter(select, init);
77
+
78
+ _dom.fireEvent.mouseOver(select);
79
+
80
+ _dom.fireEvent.mouseEnter(select);
62
81
 
63
- selectOption(option);
82
+ _dom.fireEvent.pointerUp(select, init);
64
83
 
65
- _dom.fireEvent.click(option, init);
84
+ _dom.fireEvent.mouseUp(select, init);
85
+
86
+ _dom.fireEvent.click(select, init);
87
+ } else {
88
+ throw (0, _dom.getConfig)().getElementError(`Cannot select multiple options on a non-multiple select`, select);
66
89
  }
67
- } else if (selectedOptions.length === 1) {
68
- (0, _click.click)(select, init);
69
- selectOption(selectedOptions[0]);
90
+ } else if (select.getAttribute('role') === 'listbox') {
91
+ selectedOptions.forEach(option => {
92
+ (0, _hover.hover)(option, init);
93
+ (0, _click.click)(option, init);
94
+ (0, _hover.unhover)(option, init);
95
+ });
70
96
  } else {
71
- throw (0, _dom.getConfig)().getElementError(`Cannot select multiple options on a non-multiple select`, select);
97
+ throw (0, _dom.getConfig)().getElementError(`Cannot select options on elements that are neither select nor listbox elements`, select);
72
98
  }
73
99
 
74
100
  function selectOption(option) {
75
- if (option.getAttribute('role') === 'option') {
76
- option == null ? void 0 : option.setAttribute == null ? void 0 : option.setAttribute('aria-selected', newValue);
77
- (0, _hover.hover)(option, init);
78
- (0, _click.click)(option, init);
79
- (0, _hover.unhover)(option, init);
80
- } else {
81
- option.selected = newValue;
82
- (0, _dom.fireEvent)(select, (0, _dom.createEvent)('input', select, {
83
- bubbles: true,
84
- cancelable: false,
85
- composed: true,
86
- ...init
87
- }));
88
-
89
- _dom.fireEvent.change(select, init);
90
- }
101
+ option.selected = newValue;
102
+ (0, _dom.fireEvent)(select, (0, _dom.createEvent)('input', select, {
103
+ bubbles: true,
104
+ cancelable: false,
105
+ composed: true,
106
+ ...init
107
+ }));
108
+
109
+ _dom.fireEvent.change(select, init);
91
110
  }
92
111
  }
93
112
 
package/dist/type.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.type = type;
7
+ exports.specialCharMap = void 0;
7
8
 
8
9
  var _dom = require("@testing-library/dom");
9
10
 
@@ -39,7 +40,7 @@ const modifierCallbackMap = { ...createModifierCallbackEntries({
39
40
  modifierProperty: 'metaKey'
40
41
  }),
41
42
  // capslock is inline because of the need to fire both keydown and keyup on use, while preserving the modifier state.
42
- '{capslock}': function ({
43
+ '{capslock}': function capslockOn({
43
44
  currentElement,
44
45
  eventOverrides
45
46
  }) {
@@ -67,7 +68,7 @@ const modifierCallbackMap = { ...createModifierCallbackEntries({
67
68
  eventOverrides: newEventOverrides
68
69
  };
69
70
  },
70
- '{/capslock}': function ({
71
+ '{/capslock}': function capslockOff({
71
72
  currentElement,
72
73
  eventOverrides
73
74
  }) {
@@ -96,16 +97,32 @@ const modifierCallbackMap = { ...createModifierCallbackEntries({
96
97
  };
97
98
  }
98
99
  };
100
+ const specialCharMap = {
101
+ arrowLeft: '{arrowleft}',
102
+ arrowRight: '{arrowright}',
103
+ arrowDown: '{arrowdown}',
104
+ arrowUp: '{arrowup}',
105
+ enter: '{enter}',
106
+ escape: '{esc}',
107
+ delete: '{del}',
108
+ backspace: '{backspace}',
109
+ selectAll: '{selectall}',
110
+ space: '{space}',
111
+ whitespace: ' '
112
+ };
113
+ exports.specialCharMap = specialCharMap;
99
114
  const specialCharCallbackMap = {
100
- '{arrowleft}': (0, _navigationKey.navigationKey)('ArrowLeft'),
101
- '{arrowright}': (0, _navigationKey.navigationKey)('ArrowRight'),
102
- '{enter}': handleEnter,
103
- '{esc}': handleEsc,
104
- '{del}': handleDel,
105
- '{backspace}': handleBackspace,
106
- '{selectall}': handleSelectall,
107
- '{space}': handleSpace,
108
- ' ': handleSpace
115
+ [specialCharMap.arrowLeft]: (0, _navigationKey.navigationKey)('ArrowLeft'),
116
+ [specialCharMap.arrowRight]: (0, _navigationKey.navigationKey)('ArrowRight'),
117
+ [specialCharMap.arrowDown]: handleArrowDown,
118
+ [specialCharMap.arrowUp]: handleArrowUp,
119
+ [specialCharMap.enter]: handleEnter,
120
+ [specialCharMap.escape]: handleEsc,
121
+ [specialCharMap.delete]: handleDel,
122
+ [specialCharMap.backspace]: handleBackspace,
123
+ [specialCharMap.selectAll]: handleSelectall,
124
+ [specialCharMap.space]: handleSpace,
125
+ [specialCharMap.whitespace]: handleSpace
109
126
  };
110
127
 
111
128
  function wait(time) {
@@ -178,7 +195,10 @@ async function typeImpl(element, text, {
178
195
  (0, _utils.setSelectionRangeIfNecessary)(currentElement(), initialSelectionStart != null ? initialSelectionStart : value.length, initialSelectionEnd != null ? initialSelectionEnd : value.length);
179
196
  }
180
197
 
181
- const eventCallbacks = function () {
198
+ const eventCallbacks = queueCallbacks();
199
+ await runCallbacks(eventCallbacks);
200
+
201
+ function queueCallbacks() {
182
202
  const callbacks = [];
183
203
  let remainingString = text;
184
204
 
@@ -192,9 +212,9 @@ async function typeImpl(element, text, {
192
212
  }
193
213
 
194
214
  return callbacks;
195
- }();
215
+ }
196
216
 
197
- await async function (callbacks) {
217
+ async function runCallbacks(callbacks) {
198
218
  const eventOverrides = {};
199
219
  let prevWasMinus, prevWasPeriod, prevValue, typedValue;
200
220
 
@@ -217,7 +237,7 @@ async function typeImpl(element, text, {
217
237
  typedValue = returnValue == null ? void 0 : returnValue.typedValue;
218
238
  }
219
239
  }
220
- }(eventCallbacks);
240
+ }
221
241
  }
222
242
 
223
243
  function getNextCallback(remainingString, skipAutoClose) {
@@ -273,8 +293,11 @@ function getSpecialCharCallback(remainingString) {
273
293
 
274
294
  function getTypeCallback(remainingString) {
275
295
  const character = remainingString[0];
296
+
297
+ const callback = context => typeCharacter(character, context);
298
+
276
299
  return {
277
- callback: context => typeCharacter(character, context),
300
+ callback,
278
301
  remainingString: remainingString.slice(1)
279
302
  };
280
303
  }
@@ -540,6 +563,7 @@ function createModifierCallbackEntries({
540
563
  keyCode,
541
564
  modifierProperty
542
565
  }) {
566
+ const openName = `{${name}}`;
543
567
  const closeName = `{/${name}}`;
544
568
 
545
569
  function open({
@@ -564,28 +588,31 @@ function createModifierCallbackEntries({
564
588
  }
565
589
 
566
590
  open.closeName = closeName;
567
- return {
568
- [`{${name}}`]: open,
569
- [closeName]: function ({
570
- currentElement,
571
- eventOverrides
572
- }) {
573
- const newEventOverrides = {
574
- [modifierProperty]: false
575
- };
576
-
577
- _dom.fireEvent.keyUp(currentElement(), {
578
- key,
579
- keyCode,
580
- which: keyCode,
581
- ...eventOverrides,
582
- ...newEventOverrides
583
- });
584
591
 
585
- return {
586
- eventOverrides: newEventOverrides
587
- };
588
- }
592
+ function close({
593
+ currentElement,
594
+ eventOverrides
595
+ }) {
596
+ const newEventOverrides = {
597
+ [modifierProperty]: false
598
+ };
599
+
600
+ _dom.fireEvent.keyUp(currentElement(), {
601
+ key,
602
+ keyCode,
603
+ which: keyCode,
604
+ ...eventOverrides,
605
+ ...newEventOverrides
606
+ });
607
+
608
+ return {
609
+ eventOverrides: newEventOverrides
610
+ };
611
+ }
612
+
613
+ return {
614
+ [openName]: open,
615
+ [closeName]: close
589
616
  };
590
617
  }
591
618
 
@@ -788,4 +815,48 @@ function handleSpaceOnClickable({
788
815
  _dom.fireEvent.click(currentElement(), { ...eventOverrides
789
816
  });
790
817
  }
818
+ }
819
+
820
+ function handleArrowDown({
821
+ currentElement,
822
+ eventOverrides
823
+ }) {
824
+ const key = 'ArrowDown';
825
+ const keyCode = 40;
826
+
827
+ _dom.fireEvent.keyDown(currentElement(), {
828
+ key,
829
+ keyCode,
830
+ which: keyCode,
831
+ ...eventOverrides
832
+ });
833
+
834
+ _dom.fireEvent.keyUp(currentElement(), {
835
+ key,
836
+ keyCode,
837
+ which: keyCode,
838
+ ...eventOverrides
839
+ });
840
+ }
841
+
842
+ function handleArrowUp({
843
+ currentElement,
844
+ eventOverrides
845
+ }) {
846
+ const key = 'ArrowUp';
847
+ const keyCode = 38;
848
+
849
+ _dom.fireEvent.keyDown(currentElement(), {
850
+ key,
851
+ keyCode,
852
+ which: keyCode,
853
+ ...eventOverrides
854
+ });
855
+
856
+ _dom.fireEvent.keyUp(currentElement(), {
857
+ key,
858
+ keyCode,
859
+ which: keyCode,
860
+ ...eventOverrides
861
+ });
791
862
  }
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.4.0",
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",
@@ -36,19 +36,19 @@
36
36
  "test:debug": "kcd-scripts --inspect-brk test --runInBand",
37
37
  "test:update": "npm test -- --updateSnapshot --coverage",
38
38
  "validate": "kcd-scripts validate",
39
- "typecheck": "tsc --project typings"
39
+ "typecheck": "kcd-scripts typecheck --build typings"
40
40
  },
41
41
  "dependencies": {
42
- "@babel/runtime": "^7.10.2"
42
+ "@babel/runtime": "^7.12.5"
43
43
  },
44
44
  "devDependencies": {
45
- "@testing-library/dom": "^7.21.4",
46
- "@testing-library/jest-dom": "^5.11.1",
45
+ "@testing-library/dom": "^7.28.1",
46
+ "@testing-library/jest-dom": "^5.11.6",
47
47
  "@types/estree": "0.0.45",
48
48
  "is-ci": "^2.0.0",
49
49
  "jest-serializer-ansi": "^1.0.3",
50
- "kcd-scripts": "^6.2.3",
51
- "typescript": "^4.0.5"
50
+ "kcd-scripts": "^7.5.1",
51
+ "typescript": "^4.1.2"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@testing-library/dom": ">=7.21.4"
@@ -57,6 +57,7 @@ declare const userEvent: {
57
57
  element: TargetElement,
58
58
  text: string,
59
59
  userOpts?: T,
60
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
60
61
  ) => T extends {delay: number} ? Promise<void> : void
61
62
  tab: (userOpts?: ITabUserOptions) => void
62
63
  paste: (
@@ -73,3 +74,17 @@ declare const userEvent: {
73
74
  }
74
75
 
75
76
  export default userEvent
77
+
78
+ export enum specialChars {
79
+ arrowLeft = '{arrowleft}',
80
+ arrowRight = '{arrowright}',
81
+ arrowDown = '{arrowdown}',
82
+ arrowUp = '{arrowup}',
83
+ enter = '{enter}',
84
+ escape = '{esc}',
85
+ delete = '{del}',
86
+ backspace = '{backspace}',
87
+ selectAll = '{selectall}',
88
+ space = '{space}',
89
+ whitespace = ' ',
90
+ }