@testing-library/user-event 14.0.0-beta.3 → 14.0.0-beta.7

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 (193) hide show
  1. package/dist/index.cjs +2941 -0
  2. package/dist/index.mjs +3012 -0
  3. package/dist/types/clipboard/copy.d.ts +2 -0
  4. package/dist/types/clipboard/cut.d.ts +2 -0
  5. package/dist/{clipboard → types/clipboard}/index.d.ts +0 -0
  6. package/dist/types/clipboard/paste.d.ts +2 -0
  7. package/dist/types/convenience/click.d.ts +4 -0
  8. package/dist/types/convenience/hover.d.ts +3 -0
  9. package/dist/{convenience → types/convenience}/index.d.ts +0 -0
  10. package/dist/types/convenience/tab.d.ts +4 -0
  11. package/dist/{document → types/document}/index.d.ts +0 -0
  12. package/dist/{document → types/document}/interceptor.d.ts +0 -0
  13. package/dist/{document → types/document}/selection.d.ts +0 -0
  14. package/dist/{document → types/document}/value.d.ts +0 -0
  15. package/dist/{index.d.ts → types/index.d.ts} +1 -0
  16. package/dist/{keyboard → types/keyboard}/index.d.ts +2 -2
  17. package/dist/{keyboard → types/keyboard}/keyMap.d.ts +0 -0
  18. package/dist/{keyboard → types/keyboard}/keyboardAction.d.ts +0 -0
  19. package/dist/{keyboard → types/keyboard}/parseKeyDef.d.ts +0 -0
  20. package/dist/{keyboard → types/keyboard}/plugins/arrow.d.ts +0 -0
  21. package/dist/{keyboard → types/keyboard}/plugins/character.d.ts +0 -0
  22. package/dist/{keyboard → types/keyboard}/plugins/combination.d.ts +0 -0
  23. package/dist/{keyboard → types/keyboard}/plugins/control.d.ts +0 -0
  24. package/dist/{keyboard → types/keyboard}/plugins/functional.d.ts +0 -3
  25. package/dist/{keyboard → types/keyboard}/plugins/index.d.ts +0 -0
  26. package/dist/types/keyboard/plugins/modifiers.d.ts +8 -0
  27. package/dist/{keyboard → types/keyboard}/shared/fireChangeForInputTimeIfValid.d.ts +0 -0
  28. package/dist/{keyboard → types/keyboard}/shared/index.d.ts +0 -0
  29. package/dist/{keyboard → types/keyboard}/types.d.ts +19 -5
  30. package/dist/{options.d.ts → types/options.d.ts} +23 -8
  31. package/dist/{pointer → types/pointer}/index.d.ts +2 -2
  32. package/dist/{pointer → types/pointer}/keyMap.d.ts +0 -0
  33. package/dist/{pointer → types/pointer}/parseKeyDef.d.ts +0 -0
  34. package/dist/{pointer → types/pointer}/pointerAction.d.ts +0 -0
  35. package/dist/types/pointer/pointerMove.d.ts +6 -0
  36. package/dist/{pointer → types/pointer}/pointerPress.d.ts +2 -2
  37. package/dist/{pointer → types/pointer}/resolveSelectionTarget.d.ts +0 -0
  38. package/dist/{pointer → types/pointer}/types.d.ts +0 -0
  39. package/dist/{setup → types/setup}/api.d.ts +0 -0
  40. package/dist/{setup → types/setup}/config.d.ts +0 -0
  41. package/dist/{setup → types/setup}/directApi.d.ts +1 -2
  42. package/dist/{setup → types/setup}/index.d.ts +6 -2
  43. package/dist/types/setup/setup.d.ts +19 -0
  44. package/dist/{setup → types/setup}/wrapAsync.d.ts +0 -0
  45. package/dist/types/utility/clear.d.ts +2 -0
  46. package/dist/{utility → types/utility}/index.d.ts +0 -0
  47. package/dist/types/utility/selectOptions.d.ts +3 -0
  48. package/dist/types/utility/type.d.ts +9 -0
  49. package/dist/types/utility/upload.d.ts +5 -0
  50. package/dist/{utils → types/utils}/click/isClickableInput.d.ts +0 -0
  51. package/dist/{utils → types/utils}/dataTransfer/Blob.d.ts +0 -0
  52. package/dist/{utils → types/utils}/dataTransfer/Clipboard.d.ts +0 -0
  53. package/dist/{utils → types/utils}/dataTransfer/DataTransfer.d.ts +0 -0
  54. package/dist/{utils → types/utils}/dataTransfer/FileList.d.ts +0 -0
  55. package/dist/{utils → types/utils}/edit/buildTimeValue.d.ts +0 -0
  56. package/dist/{utils → types/utils}/edit/calculateNewValue.d.ts +0 -0
  57. package/dist/{utils → types/utils}/edit/editInputElement.d.ts +0 -0
  58. package/dist/{utils → types/utils}/edit/getValue.d.ts +0 -0
  59. package/dist/{utils → types/utils}/edit/isContentEditable.d.ts +0 -0
  60. package/dist/{utils → types/utils}/edit/isEditable.d.ts +0 -0
  61. package/dist/{utils → types/utils}/edit/isValidDateValue.d.ts +0 -0
  62. package/dist/{utils → types/utils}/edit/isValidInputTimeValue.d.ts +0 -0
  63. package/dist/{utils → types/utils}/edit/maxLength.d.ts +0 -0
  64. package/dist/{utils → types/utils}/edit/prepareInput.d.ts +0 -0
  65. package/dist/{utils → types/utils}/edit/setFiles.d.ts +0 -0
  66. package/dist/{utils → types/utils}/focus/blur.d.ts +0 -0
  67. package/dist/{utils → types/utils}/focus/copySelection.d.ts +0 -0
  68. package/dist/types/utils/focus/cursor.d.ts +9 -0
  69. package/dist/{utils → types/utils}/focus/focus.d.ts +0 -0
  70. package/dist/{utils → types/utils}/focus/getActiveElement.d.ts +0 -0
  71. package/dist/{utils → types/utils}/focus/getTabDestination.d.ts +0 -0
  72. package/dist/{utils → types/utils}/focus/isFocusable.d.ts +0 -0
  73. package/dist/{utils → types/utils}/focus/selectAll.d.ts +0 -0
  74. package/dist/{utils → types/utils}/focus/selection.d.ts +0 -0
  75. package/dist/{utils → types/utils}/focus/selector.d.ts +0 -0
  76. package/dist/{utils → types/utils}/index.d.ts +5 -1
  77. package/dist/{utils → types/utils}/keyDef/readNextDescriptor.d.ts +0 -0
  78. package/dist/types/utils/keyboard/getKeyEventProps.d.ts +17 -0
  79. package/dist/types/utils/keyboard/getUIEventModifiers.d.ts +15 -0
  80. package/dist/{utils → types/utils}/misc/eventWrapper.d.ts +0 -0
  81. package/dist/{utils → types/utils}/misc/findClosest.d.ts +0 -0
  82. package/dist/{utils → types/utils}/misc/getDocumentFromNode.d.ts +0 -0
  83. package/dist/{utils → types/utils}/misc/hasFormSubmit.d.ts +0 -0
  84. package/dist/{utils → types/utils}/misc/isDescendantOrSelf.d.ts +0 -0
  85. package/dist/{utils → types/utils}/misc/isDisabled.d.ts +0 -0
  86. package/dist/{utils → types/utils}/misc/isElementType.d.ts +0 -0
  87. package/dist/{utils → types/utils}/misc/isVisible.d.ts +0 -0
  88. package/dist/types/utils/misc/level.d.ts +17 -0
  89. package/dist/{utils → types/utils}/misc/wait.d.ts +0 -0
  90. package/dist/types/utils/pointer/cssPointerEvents.d.ts +15 -0
  91. package/dist/{utils → types/utils}/pointer/firePointerEvents.d.ts +0 -0
  92. package/dist/{utils → types/utils}/pointer/mouseButtons.d.ts +0 -0
  93. package/package.json +13 -30
  94. package/dist/clipboard/copy.d.ts +0 -2
  95. package/dist/clipboard/copy.js +0 -36
  96. package/dist/clipboard/cut.d.ts +0 -2
  97. package/dist/clipboard/cut.js +0 -42
  98. package/dist/clipboard/index.js +0 -44
  99. package/dist/clipboard/paste.d.ts +0 -2
  100. package/dist/clipboard/paste.js +0 -47
  101. package/dist/convenience/click.d.ts +0 -4
  102. package/dist/convenience/click.js +0 -52
  103. package/dist/convenience/hover.d.ts +0 -3
  104. package/dist/convenience/hover.js +0 -31
  105. package/dist/convenience/index.js +0 -44
  106. package/dist/convenience/tab.d.ts +0 -4
  107. package/dist/convenience/tab.js +0 -12
  108. package/dist/document/index.js +0 -100
  109. package/dist/document/interceptor.js +0 -37
  110. package/dist/document/selection.js +0 -90
  111. package/dist/document/value.js +0 -77
  112. package/dist/index.js +0 -13
  113. package/dist/keyboard/getEventProps.d.ts +0 -15
  114. package/dist/keyboard/getEventProps.js +0 -27
  115. package/dist/keyboard/index.js +0 -42
  116. package/dist/keyboard/keyMap.js +0 -119
  117. package/dist/keyboard/keyboardAction.js +0 -156
  118. package/dist/keyboard/parseKeyDef.js +0 -61
  119. package/dist/keyboard/plugins/arrow.js +0 -28
  120. package/dist/keyboard/plugins/character.js +0 -173
  121. package/dist/keyboard/plugins/combination.js +0 -19
  122. package/dist/keyboard/plugins/control.js +0 -52
  123. package/dist/keyboard/plugins/functional.js +0 -158
  124. package/dist/keyboard/plugins/index.js +0 -33
  125. package/dist/keyboard/shared/fireChangeForInputTimeIfValid.js +0 -20
  126. package/dist/keyboard/shared/index.js +0 -18
  127. package/dist/keyboard/types.js +0 -19
  128. package/dist/options.js +0 -36
  129. package/dist/pointer/index.js +0 -56
  130. package/dist/pointer/keyMap.js +0 -29
  131. package/dist/pointer/parseKeyDef.js +0 -34
  132. package/dist/pointer/pointerAction.js +0 -46
  133. package/dist/pointer/pointerMove.d.ts +0 -6
  134. package/dist/pointer/pointerMove.js +0 -136
  135. package/dist/pointer/pointerPress.js +0 -327
  136. package/dist/pointer/resolveSelectionTarget.js +0 -75
  137. package/dist/pointer/types.js +0 -1
  138. package/dist/setup/api.js +0 -111
  139. package/dist/setup/config.js +0 -8
  140. package/dist/setup/directApi.js +0 -95
  141. package/dist/setup/index.js +0 -27
  142. package/dist/setup/setup.d.ts +0 -74
  143. package/dist/setup/setup.js +0 -98
  144. package/dist/setup/wrapAsync.js +0 -15
  145. package/dist/utility/clear.d.ts +0 -2
  146. package/dist/utility/clear.js +0 -30
  147. package/dist/utility/index.js +0 -57
  148. package/dist/utility/selectOptions.d.ts +0 -3
  149. package/dist/utility/selectOptions.js +0 -132
  150. package/dist/utility/type.d.ts +0 -9
  151. package/dist/utility/type.js +0 -37
  152. package/dist/utility/upload.d.ts +0 -5
  153. package/dist/utility/upload.js +0 -64
  154. package/dist/utils/click/isClickableInput.js +0 -14
  155. package/dist/utils/dataTransfer/Blob.js +0 -21
  156. package/dist/utils/dataTransfer/Clipboard.js +0 -188
  157. package/dist/utils/dataTransfer/DataTransfer.js +0 -158
  158. package/dist/utils/dataTransfer/FileList.js +0 -23
  159. package/dist/utils/edit/buildTimeValue.js +0 -44
  160. package/dist/utils/edit/calculateNewValue.js +0 -46
  161. package/dist/utils/edit/editInputElement.js +0 -53
  162. package/dist/utils/edit/getValue.js +0 -23
  163. package/dist/utils/edit/isContentEditable.js +0 -25
  164. package/dist/utils/edit/isEditable.js +0 -42
  165. package/dist/utils/edit/isValidDateValue.js +0 -12
  166. package/dist/utils/edit/isValidInputTimeValue.js +0 -12
  167. package/dist/utils/edit/maxLength.js +0 -50
  168. package/dist/utils/edit/prepareInput.js +0 -77
  169. package/dist/utils/edit/setFiles.js +0 -72
  170. package/dist/utils/focus/blur.js +0 -19
  171. package/dist/utils/focus/copySelection.js +0 -36
  172. package/dist/utils/focus/focus.js +0 -22
  173. package/dist/utils/focus/getActiveElement.js +0 -26
  174. package/dist/utils/focus/getTabDestination.js +0 -84
  175. package/dist/utils/focus/isFocusable.js +0 -12
  176. package/dist/utils/focus/selectAll.js +0 -51
  177. package/dist/utils/focus/selection.js +0 -190
  178. package/dist/utils/focus/selector.js +0 -8
  179. package/dist/utils/index.js +0 -499
  180. package/dist/utils/keyDef/readNextDescriptor.js +0 -102
  181. package/dist/utils/misc/eventWrapper.js +0 -16
  182. package/dist/utils/misc/findClosest.js +0 -20
  183. package/dist/utils/misc/getDocumentFromNode.js +0 -14
  184. package/dist/utils/misc/hasFormSubmit.js +0 -10
  185. package/dist/utils/misc/hasPointerEvents.d.ts +0 -15
  186. package/dist/utils/misc/hasPointerEvents.js +0 -24
  187. package/dist/utils/misc/isDescendantOrSelf.js +0 -20
  188. package/dist/utils/misc/isDisabled.js +0 -12
  189. package/dist/utils/misc/isElementType.js +0 -24
  190. package/dist/utils/misc/isVisible.js +0 -31
  191. package/dist/utils/misc/wait.js +0 -10
  192. package/dist/utils/pointer/firePointerEvents.js +0 -110
  193. package/dist/utils/pointer/mouseButtons.js +0 -45
@@ -0,0 +1,2 @@
1
+ import { Instance } from '../setup';
2
+ export declare function copy(this: Instance): Promise<DataTransfer | undefined>;
@@ -0,0 +1,2 @@
1
+ import { Instance } from '../setup';
2
+ export declare function cut(this: Instance): Promise<DataTransfer | undefined>;
File without changes
@@ -0,0 +1,2 @@
1
+ import { Instance } from '../setup';
2
+ export declare function paste(this: Instance, clipboardData?: DataTransfer | string): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { Instance } from '../setup';
2
+ export declare function click(this: Instance, element: Element): Promise<void>;
3
+ export declare function dblClick(this: Instance, element: Element): Promise<void>;
4
+ export declare function tripleClick(this: Instance, element: Element): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { Instance } from '../setup';
2
+ export declare function hover(this: Instance, element: Element): Promise<void>;
3
+ export declare function unhover(this: Instance, element: Element): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { Instance } from '../setup';
2
+ export declare function tab(this: Instance, { shift, }?: {
3
+ shift?: boolean;
4
+ }): Promise<void>;
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
1
  export { userEvent as default } from './setup';
2
2
  export type { keyboardKey } from './keyboard';
3
3
  export type { pointerKey } from './pointer';
4
+ export { PointerEventsCheckLevel } from './options';
@@ -1,7 +1,7 @@
1
- import { UserEvent } from '../setup';
1
+ import { Instance } from '../setup';
2
2
  import { releaseAllKeys } from './keyboardAction';
3
3
  import type { keyboardState, keyboardKey } from './types';
4
4
  export { releaseAllKeys };
5
5
  export type { keyboardKey, keyboardState };
6
- export declare function keyboard(this: UserEvent, text: string): Promise<void>;
6
+ export declare function keyboard(this: Instance, text: string): Promise<void>;
7
7
  export declare function createKeyboardState(): keyboardState;
File without changes
@@ -3,9 +3,6 @@
3
3
  * https://w3c.github.io/uievents-code/#key-alphanumeric-functional
4
4
  */
5
5
  import { behaviorPlugin } from '../types';
6
- export declare const preKeydownBehavior: behaviorPlugin[];
7
6
  export declare const keydownBehavior: behaviorPlugin[];
8
7
  export declare const keypressBehavior: behaviorPlugin[];
9
- export declare const preKeyupBehavior: behaviorPlugin[];
10
8
  export declare const keyupBehavior: behaviorPlugin[];
11
- export declare const postKeyupBehavior: behaviorPlugin[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file should contain behavior for modifier keys:
3
+ * https://www.w3.org/TR/uievents-key/#keys-modifier
4
+ */
5
+ import { behaviorPlugin } from '../types';
6
+ export declare const preKeydownBehavior: behaviorPlugin[];
7
+ export declare const preKeyupBehavior: behaviorPlugin[];
8
+ export declare const postKeyupBehavior: behaviorPlugin[];
@@ -14,11 +14,25 @@ export declare type keyboardState = {
14
14
  Active modifiers
15
15
  */
16
16
  modifiers: {
17
- alt: boolean;
18
- caps: boolean;
19
- ctrl: boolean;
20
- meta: boolean;
21
- shift: boolean;
17
+ Alt: boolean;
18
+ AltGraph: boolean;
19
+ CapsLock: boolean;
20
+ Control: boolean;
21
+ Fn: boolean;
22
+ FnLock: boolean;
23
+ Meta: boolean;
24
+ NumLock: boolean;
25
+ ScrollLock: boolean;
26
+ Shift: boolean;
27
+ Symbol: boolean;
28
+ SymbolLock: boolean;
29
+ };
30
+ modifierPhase: {
31
+ CapsLock?: boolean;
32
+ FnLock?: boolean;
33
+ NumLock?: boolean;
34
+ ScrollLock?: boolean;
35
+ SymbolLock?: boolean;
22
36
  };
23
37
  /**
24
38
  The element the keyboard input is performed on.
@@ -1,5 +1,18 @@
1
1
  import type { keyboardKey } from './keyboard/types';
2
2
  import type { pointerKey } from './pointer/types';
3
+ export declare enum PointerEventsCheckLevel {
4
+ /**
5
+ * Check pointer events on every user interaction that triggers a bunch of events.
6
+ * E.g. once for releasing a mouse button even though this triggers `pointerup`, `mouseup`, `click`, etc...
7
+ */
8
+ EachTrigger = 4,
9
+ /** Check each target once per call to pointer (related) API */
10
+ EachApiCall = 2,
11
+ /** Check each event target once */
12
+ EachTarget = 1,
13
+ /** No pointer events check */
14
+ Never = 0
15
+ }
3
16
  export interface Options {
4
17
  /**
5
18
  * When using `userEvent.upload`, automatically discard files
@@ -52,6 +65,16 @@ export interface Options {
52
65
  * This allows to plug in different pointer devices.
53
66
  */
54
67
  pointerMap?: pointerKey[];
68
+ /**
69
+ * The pointer API includes a check if an element has or inherits `pointer-events: none`.
70
+ * This check is known to be expensive and very expensive when checking deeply nested nodes.
71
+ * This option determines how often the pointer related APIs perform the check.
72
+ *
73
+ * This is a binary flag option. You can combine multiple Levels.
74
+ *
75
+ * @default PointerEventsCheckLevel.EachCall
76
+ */
77
+ pointerEventsCheck?: PointerEventsCheckLevel | number;
55
78
  /**
56
79
  * `userEvent.type` automatically releases any keys still pressed at the end of the call.
57
80
  * This option allows to opt out of this feature.
@@ -73,14 +96,6 @@ export interface Options {
73
96
  * @default false
74
97
  */
75
98
  skipHover?: boolean;
76
- /**
77
- * Calling pointer related APIs on an element triggers a check if that element can receive pointer events.
78
- * This check is known to be expensive.
79
- * This option allows to skip the check.
80
- *
81
- * @default false
82
- */
83
- skipPointerEventsCheck?: boolean;
84
99
  /**
85
100
  * Write selected data to Clipboard API when a `cut` or `copy` is triggered.
86
101
  *
@@ -1,4 +1,4 @@
1
- import { UserEvent } from '../setup';
1
+ import { Instance } from '../setup';
2
2
  import { PointerAction, PointerActionTarget } from './pointerAction';
3
3
  import type { pointerState, pointerKey } from './types';
4
4
  export type { pointerState, pointerKey };
@@ -6,5 +6,5 @@ declare type PointerActionInput = string | ({
6
6
  keys: string;
7
7
  } & PointerActionTarget) | PointerAction;
8
8
  export declare type PointerInput = PointerActionInput | Array<PointerActionInput>;
9
- export declare function pointer(this: UserEvent, input: PointerInput): Promise<void>;
9
+ export declare function pointer(this: Instance, input: PointerInput): Promise<void>;
10
10
  export declare function createPointerState(document: Document): pointerState;
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ import { Config } from '../setup';
2
+ import { PointerTarget, SelectionTarget } from './types';
3
+ export interface PointerMoveAction extends PointerTarget, SelectionTarget {
4
+ pointerName?: string;
5
+ }
6
+ export declare function pointerMove(config: Config, { pointerName, target, coords, node, offset }: PointerMoveAction): Promise<void>;
@@ -1,8 +1,8 @@
1
- import { inputDeviceState } from '../setup';
1
+ import { Config } from '../setup';
2
2
  import type { pointerKey, PointerTarget, SelectionTarget } from './types';
3
3
  export interface PointerPressAction extends PointerTarget, SelectionTarget {
4
4
  keyDef: pointerKey;
5
5
  releasePrevious: boolean;
6
6
  releaseSelf: boolean;
7
7
  }
8
- export declare function pointerPress(action: PointerPressAction, state: inputDeviceState): Promise<void>;
8
+ export declare function pointerPress(config: Config, action: PointerPressAction): Promise<void>;
File without changes
File without changes
File without changes
@@ -1,4 +1,3 @@
1
- import type { PointerOptions } from '../utils';
2
1
  import type { PointerInput } from '../pointer';
3
2
  import type { UserEventApi } from '.';
4
3
  import { Config } from './config';
@@ -15,6 +14,6 @@ export declare function paste(clipboardData?: DataTransfer | string, options?: P
15
14
  export declare function selectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: Partial<Config>): Promise<void>;
16
15
  export declare function tripleClick(element: Element, options?: Partial<Config>): Promise<void>;
17
16
  export declare function type(element: Element, text: string, options?: Partial<Config> & Parameters<UserEventApi['type']>[2]): Promise<void>;
18
- export declare function unhover(element: Element, options?: PointerOptions): Promise<void>;
17
+ export declare function unhover(element: Element, options?: Partial<Config>): Promise<void>;
19
18
  export declare function upload(element: HTMLElement, fileOrFiles: File | File[], options?: Partial<Config>): Promise<void>;
20
19
  export declare function tab(options?: Partial<Config> & Parameters<UserEventApi['tab']>[0]): Promise<void>;
@@ -5,10 +5,14 @@ import * as directApi from './directApi';
5
5
  export type { inputDeviceState };
6
6
  export { Config };
7
7
  export declare type UserEventApi = typeof userEventApi;
8
- export declare type UserEvent = UserEventApi & {
9
- readonly setup: typeof setupSub;
8
+ export declare type Instance = UserEventApi & {
10
9
  [Config]: Config;
11
10
  };
11
+ export declare type UserEvent = {
12
+ readonly setup: (...args: Parameters<typeof setupSub>) => UserEvent;
13
+ } & {
14
+ readonly [k in keyof UserEventApi]: (...args: Parameters<UserEventApi[k]>) => ReturnType<UserEventApi[k]>;
15
+ };
12
16
  export declare const userEvent: {
13
17
  readonly setup: typeof setupMain;
14
18
  readonly clear: typeof directApi.clear;
@@ -0,0 +1,19 @@
1
+ import { Options } from '../options';
2
+ import type { Instance, UserEvent } from './index';
3
+ import { Config } from './config';
4
+ /**
5
+ * Start a "session" with userEvent.
6
+ * All APIs returned by this function share an input device state and a default configuration.
7
+ */
8
+ export declare function setupMain(options?: Options): UserEvent;
9
+ /**
10
+ * Setup in direct call per `userEvent.anyApi()`
11
+ */
12
+ export declare function setupDirect(options?: Partial<Config>, node?: Node): {
13
+ config: Config;
14
+ api: UserEvent;
15
+ };
16
+ /**
17
+ * Create a set of callbacks with different default settings but the same state.
18
+ */
19
+ export declare function setupSub(this: Instance, options: Options): UserEvent;
File without changes
@@ -0,0 +1,2 @@
1
+ import type { Instance } from '../setup';
2
+ export declare function clear(this: Instance, element: Element): Promise<void>;
File without changes
@@ -0,0 +1,3 @@
1
+ import { Instance } from '../setup';
2
+ export declare function selectOptions(this: Instance, select: Element, values: HTMLElement | HTMLElement[] | string[] | string): Promise<void>;
3
+ export declare function deselectOptions(this: Instance, select: Element, values: HTMLElement | HTMLElement[] | string[] | string): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import type { Instance } from '../setup';
2
+ import { Config } from '../setup/config';
3
+ export interface typeOptions {
4
+ skipClick?: Config['skipClick'];
5
+ skipAutoClose?: Config['skipClick'];
6
+ initialSelectionStart?: number;
7
+ initialSelectionEnd?: number;
8
+ }
9
+ export declare function type(this: Instance, element: Element, text: string, { skipClick, skipAutoClose, initialSelectionStart, initialSelectionEnd, }?: typeOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { Instance } from '../setup';
2
+ export interface uploadInit {
3
+ changeInit?: EventInit;
4
+ }
5
+ export declare function upload(this: Instance, element: HTMLElement, fileOrFiles: File | File[]): Promise<void>;
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ interface Text {
3
+ nodeValue: string;
4
+ }
5
+ }
6
+ export declare function getNextCursorPosition(node: Node, offset: number, direction: -1 | 1, inputType?: string): {
7
+ node: Node;
8
+ offset: number;
9
+ } | undefined;
File without changes
File without changes
File without changes
File without changes
@@ -16,6 +16,7 @@ export * from './edit/prepareInput';
16
16
  export * from './edit/setFiles';
17
17
  export * from './focus/blur';
18
18
  export * from './focus/copySelection';
19
+ export * from './focus/cursor';
19
20
  export * from './focus/focus';
20
21
  export * from './focus/getActiveElement';
21
22
  export * from './focus/getTabDestination';
@@ -23,6 +24,8 @@ export * from './focus/isFocusable';
23
24
  export * from './focus/selectAll';
24
25
  export * from './focus/selection';
25
26
  export * from './focus/selector';
27
+ export * from './keyboard/getKeyEventProps';
28
+ export * from './keyboard/getUIEventModifiers';
26
29
  export * from './keyDef/readNextDescriptor';
27
30
  export * from './misc/eventWrapper';
28
31
  export * from './misc/findClosest';
@@ -31,8 +34,9 @@ export * from './misc/isDescendantOrSelf';
31
34
  export * from './misc/isElementType';
32
35
  export * from './misc/isVisible';
33
36
  export * from './misc/isDisabled';
37
+ export * from './misc/level';
34
38
  export * from './misc/wait';
35
- export * from './misc/hasPointerEvents';
36
39
  export * from './misc/hasFormSubmit';
40
+ export * from './pointer/cssPointerEvents';
37
41
  export * from './pointer/firePointerEvents';
38
42
  export * from './pointer/mouseButtons';
@@ -0,0 +1,17 @@
1
+ import { keyboardKey, keyboardState } from '../../keyboard/types';
2
+ export declare function getKeyEventProps(keyDef: keyboardKey, state: keyboardState): {
3
+ altKey: boolean;
4
+ ctrlKey: boolean;
5
+ metaKey: boolean;
6
+ shiftKey: boolean;
7
+ modifierAltGraph: boolean;
8
+ modifierCapsLock: boolean;
9
+ modifierFn: boolean;
10
+ modifierFnLock: boolean;
11
+ modifierNumLock: boolean;
12
+ modifierScrollLock: boolean;
13
+ modifierSymbol: boolean;
14
+ modifierSymbolLock: boolean;
15
+ key: string | undefined;
16
+ code: string | undefined;
17
+ };
@@ -0,0 +1,15 @@
1
+ import type { keyboardState } from '../../keyboard';
2
+ export declare function getUIEventModifiers(keyboardState: keyboardState): {
3
+ altKey: boolean;
4
+ ctrlKey: boolean;
5
+ metaKey: boolean;
6
+ shiftKey: boolean;
7
+ modifierAltGraph: boolean;
8
+ modifierCapsLock: boolean;
9
+ modifierFn: boolean;
10
+ modifierFnLock: boolean;
11
+ modifierNumLock: boolean;
12
+ modifierScrollLock: boolean;
13
+ modifierSymbol: boolean;
14
+ modifierSymbolLock: boolean;
15
+ };
File without changes
File without changes
@@ -0,0 +1,17 @@
1
+ import { Config } from '../../setup';
2
+ export declare enum ApiLevel {
3
+ Trigger = 2,
4
+ Call = 1
5
+ }
6
+ declare const Level: unique symbol;
7
+ interface LevelRefs {
8
+ [k: number]: object | undefined;
9
+ }
10
+ declare module '../../setup' {
11
+ interface Config {
12
+ [Level]?: LevelRefs;
13
+ }
14
+ }
15
+ export declare function setLevelRef(config: Config, level: ApiLevel): void;
16
+ export declare function getLevelRef(config: Config, level: ApiLevel): object | undefined;
17
+ export {};
File without changes
@@ -0,0 +1,15 @@
1
+ import { Config } from '../../setup';
2
+ import { ApiLevel } from '..';
3
+ export declare function hasPointerEvents(element: Element): boolean;
4
+ declare const PointerEventsCheck: unique symbol;
5
+ declare global {
6
+ interface Element {
7
+ [PointerEventsCheck]?: {
8
+ [k in ApiLevel]?: object;
9
+ } & {
10
+ result: boolean;
11
+ };
12
+ }
13
+ }
14
+ export declare function assertPointerEvents(config: Config, element: Element): void;
15
+ export {};
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@testing-library/user-event",
3
- "version": "14.0.0-beta.3",
3
+ "version": "14.0.0-beta.7",
4
4
  "description": "Fire events the same way the user does",
5
- "main": "dist/index.js",
6
5
  "keywords": [
7
6
  "react-testing-library",
8
7
  "dom-testing-library",
@@ -26,8 +25,17 @@
26
25
  "files": [
27
26
  "dist"
28
27
  ],
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.mjs",
30
+ "exports": {
31
+ ".": {
32
+ "require": "./dist/index.cjs",
33
+ "default": "./dist/index.mjs"
34
+ }
35
+ },
36
+ "types": "./dist/types/index.d.ts",
29
37
  "scripts": {
30
- "build": "kcd-scripts build --no-ts-defs && tsc -p tsconfig.build.json",
38
+ "build": "node build.js",
31
39
  "lint": "kcd-scripts lint",
32
40
  "setup": "npm install && npm run validate -s",
33
41
  "test": "kcd-scripts test",
@@ -46,6 +54,7 @@
46
54
  "@types/estree": "0.0.45",
47
55
  "@types/jest-in-case": "^1.0.3",
48
56
  "@types/react": "^17.0.3",
57
+ "esbuild": "^0.14.9",
49
58
  "eslint-import-resolver-typescript": "^2.5.0",
50
59
  "is-ci": "^2.0.0",
51
60
  "jest-in-case": "^1.0.2",
@@ -57,31 +66,5 @@
57
66
  },
58
67
  "peerDependencies": {
59
68
  "@testing-library/dom": ">=7.21.4"
60
- },
61
- "eslintConfig": {
62
- "extends": "./node_modules/kcd-scripts/eslint.js",
63
- "rules": {
64
- "jsx-a11y/click-events-have-key-events": "off",
65
- "jsx-a11y/tabindex-no-positive": "off",
66
- "no-func-assign": "off",
67
- "no-return-assign": "off",
68
- "react/prop-types": "off",
69
- "testing-library/no-dom-import": "off"
70
- },
71
- "overrides": [
72
- {
73
- "files": [
74
- "**/__tests__/**"
75
- ],
76
- "rules": {
77
- "no-console": "off"
78
- }
79
- }
80
- ]
81
- },
82
- "eslintIgnore": [
83
- "node_modules",
84
- "coverage",
85
- "dist"
86
- ]
69
+ }
87
70
  }
@@ -1,2 +0,0 @@
1
- import { UserEvent } from '../setup';
2
- export declare function copy(this: UserEvent): Promise<DataTransfer | undefined>;