@testing-library/user-event 14.0.0-beta.3 → 14.0.0-beta.4
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/dist/index.d.ts +1110 -3
- package/dist/index.js +2826 -8
- package/dist/package.json +1 -0
- package/package.json +6 -30
- package/dist/clipboard/copy.d.ts +0 -2
- package/dist/clipboard/copy.js +0 -36
- package/dist/clipboard/cut.d.ts +0 -2
- package/dist/clipboard/cut.js +0 -42
- package/dist/clipboard/index.d.ts +0 -3
- package/dist/clipboard/index.js +0 -44
- package/dist/clipboard/paste.d.ts +0 -2
- package/dist/clipboard/paste.js +0 -47
- package/dist/convenience/click.d.ts +0 -4
- package/dist/convenience/click.js +0 -52
- package/dist/convenience/hover.d.ts +0 -3
- package/dist/convenience/hover.js +0 -31
- package/dist/convenience/index.d.ts +0 -3
- package/dist/convenience/index.js +0 -44
- package/dist/convenience/tab.d.ts +0 -4
- package/dist/convenience/tab.js +0 -12
- package/dist/document/index.d.ts +0 -10
- package/dist/document/index.js +0 -100
- package/dist/document/interceptor.d.ts +0 -15
- package/dist/document/interceptor.js +0 -37
- package/dist/document/selection.d.ts +0 -27
- package/dist/document/selection.js +0 -90
- package/dist/document/value.d.ts +0 -18
- package/dist/document/value.js +0 -77
- package/dist/keyboard/getEventProps.d.ts +0 -15
- package/dist/keyboard/getEventProps.js +0 -27
- package/dist/keyboard/index.d.ts +0 -7
- package/dist/keyboard/index.js +0 -42
- package/dist/keyboard/keyMap.d.ts +0 -5
- package/dist/keyboard/keyMap.js +0 -119
- package/dist/keyboard/keyboardAction.d.ts +0 -10
- package/dist/keyboard/keyboardAction.js +0 -156
- package/dist/keyboard/parseKeyDef.d.ts +0 -17
- package/dist/keyboard/parseKeyDef.js +0 -61
- package/dist/keyboard/plugins/arrow.d.ts +0 -6
- package/dist/keyboard/plugins/arrow.js +0 -28
- package/dist/keyboard/plugins/character.d.ts +0 -5
- package/dist/keyboard/plugins/character.js +0 -173
- package/dist/keyboard/plugins/combination.d.ts +0 -5
- package/dist/keyboard/plugins/combination.js +0 -19
- package/dist/keyboard/plugins/control.d.ts +0 -6
- package/dist/keyboard/plugins/control.js +0 -52
- package/dist/keyboard/plugins/functional.d.ts +0 -11
- package/dist/keyboard/plugins/functional.js +0 -158
- package/dist/keyboard/plugins/index.d.ts +0 -7
- package/dist/keyboard/plugins/index.js +0 -33
- package/dist/keyboard/shared/fireChangeForInputTimeIfValid.d.ts +0 -3
- package/dist/keyboard/shared/fireChangeForInputTimeIfValid.js +0 -20
- package/dist/keyboard/shared/index.d.ts +0 -1
- package/dist/keyboard/shared/index.js +0 -18
- package/dist/keyboard/types.d.ts +0 -64
- package/dist/keyboard/types.js +0 -19
- package/dist/options.d.ts +0 -102
- package/dist/options.js +0 -36
- package/dist/pointer/index.d.ts +0 -10
- package/dist/pointer/index.js +0 -56
- package/dist/pointer/keyMap.d.ts +0 -2
- package/dist/pointer/keyMap.js +0 -29
- package/dist/pointer/parseKeyDef.d.ts +0 -6
- package/dist/pointer/parseKeyDef.js +0 -34
- package/dist/pointer/pointerAction.d.ts +0 -7
- package/dist/pointer/pointerAction.js +0 -46
- package/dist/pointer/pointerMove.d.ts +0 -6
- package/dist/pointer/pointerMove.js +0 -136
- package/dist/pointer/pointerPress.d.ts +0 -8
- package/dist/pointer/pointerPress.js +0 -327
- package/dist/pointer/resolveSelectionTarget.d.ts +0 -5
- package/dist/pointer/resolveSelectionTarget.js +0 -75
- package/dist/pointer/types.d.ts +0 -61
- package/dist/pointer/types.js +0 -1
- package/dist/setup/api.d.ts +0 -5
- package/dist/setup/api.js +0 -111
- package/dist/setup/config.d.ts +0 -10
- package/dist/setup/config.js +0 -8
- package/dist/setup/directApi.d.ts +0 -20
- package/dist/setup/directApi.js +0 -95
- package/dist/setup/index.d.ts +0 -30
- package/dist/setup/index.js +0 -27
- package/dist/setup/setup.d.ts +0 -74
- package/dist/setup/setup.js +0 -98
- package/dist/setup/wrapAsync.d.ts +0 -4
- package/dist/setup/wrapAsync.js +0 -15
- package/dist/utility/clear.d.ts +0 -2
- package/dist/utility/clear.js +0 -30
- package/dist/utility/index.d.ts +0 -4
- package/dist/utility/index.js +0 -57
- package/dist/utility/selectOptions.d.ts +0 -3
- package/dist/utility/selectOptions.js +0 -132
- package/dist/utility/type.d.ts +0 -9
- package/dist/utility/type.js +0 -37
- package/dist/utility/upload.d.ts +0 -5
- package/dist/utility/upload.js +0 -64
- package/dist/utils/click/isClickableInput.d.ts +0 -1
- package/dist/utils/click/isClickableInput.js +0 -14
- package/dist/utils/dataTransfer/Blob.d.ts +0 -1
- package/dist/utils/dataTransfer/Blob.js +0 -21
- package/dist/utils/dataTransfer/Clipboard.d.ts +0 -9
- package/dist/utils/dataTransfer/Clipboard.js +0 -188
- package/dist/utils/dataTransfer/DataTransfer.d.ts +0 -2
- package/dist/utils/dataTransfer/DataTransfer.js +0 -158
- package/dist/utils/dataTransfer/FileList.d.ts +0 -1
- package/dist/utils/dataTransfer/FileList.js +0 -23
- package/dist/utils/edit/buildTimeValue.d.ts +0 -1
- package/dist/utils/edit/buildTimeValue.js +0 -44
- package/dist/utils/edit/calculateNewValue.d.ts +0 -14
- package/dist/utils/edit/calculateNewValue.js +0 -46
- package/dist/utils/edit/editInputElement.d.ts +0 -16
- package/dist/utils/edit/editInputElement.js +0 -53
- package/dist/utils/edit/getValue.d.ts +0 -1
- package/dist/utils/edit/getValue.js +0 -23
- package/dist/utils/edit/isContentEditable.d.ts +0 -7
- package/dist/utils/edit/isContentEditable.js +0 -25
- package/dist/utils/edit/isEditable.d.ts +0 -25
- package/dist/utils/edit/isEditable.js +0 -42
- package/dist/utils/edit/isValidDateValue.d.ts +0 -3
- package/dist/utils/edit/isValidDateValue.js +0 -12
- package/dist/utils/edit/isValidInputTimeValue.d.ts +0 -3
- package/dist/utils/edit/isValidInputTimeValue.js +0 -12
- package/dist/utils/edit/maxLength.d.ts +0 -1
- package/dist/utils/edit/maxLength.js +0 -50
- package/dist/utils/edit/prepareInput.d.ts +0 -7
- package/dist/utils/edit/prepareInput.js +0 -77
- package/dist/utils/edit/setFiles.d.ts +0 -12
- package/dist/utils/edit/setFiles.js +0 -72
- package/dist/utils/focus/blur.d.ts +0 -2
- package/dist/utils/focus/blur.js +0 -19
- package/dist/utils/focus/copySelection.d.ts +0 -1
- package/dist/utils/focus/copySelection.js +0 -36
- package/dist/utils/focus/focus.d.ts +0 -2
- package/dist/utils/focus/focus.js +0 -22
- package/dist/utils/focus/getActiveElement.d.ts +0 -1
- package/dist/utils/focus/getActiveElement.js +0 -26
- package/dist/utils/focus/getTabDestination.d.ts +0 -1
- package/dist/utils/focus/getTabDestination.js +0 -84
- package/dist/utils/focus/isFocusable.d.ts +0 -1
- package/dist/utils/focus/isFocusable.js +0 -12
- package/dist/utils/focus/selectAll.d.ts +0 -5
- package/dist/utils/focus/selectAll.js +0 -51
- package/dist/utils/focus/selection.d.ts +0 -42
- package/dist/utils/focus/selection.js +0 -190
- package/dist/utils/focus/selector.d.ts +0 -1
- package/dist/utils/focus/selector.js +0 -8
- package/dist/utils/index.d.ts +0 -38
- package/dist/utils/index.js +0 -499
- package/dist/utils/keyDef/readNextDescriptor.d.ts +0 -19
- package/dist/utils/keyDef/readNextDescriptor.js +0 -102
- package/dist/utils/misc/eventWrapper.d.ts +0 -1
- package/dist/utils/misc/eventWrapper.js +0 -16
- package/dist/utils/misc/findClosest.d.ts +0 -1
- package/dist/utils/misc/findClosest.js +0 -20
- package/dist/utils/misc/getDocumentFromNode.d.ts +0 -1
- package/dist/utils/misc/getDocumentFromNode.js +0 -14
- package/dist/utils/misc/hasFormSubmit.d.ts +0 -1
- package/dist/utils/misc/hasFormSubmit.js +0 -10
- package/dist/utils/misc/hasPointerEvents.d.ts +0 -15
- package/dist/utils/misc/hasPointerEvents.js +0 -24
- package/dist/utils/misc/isDescendantOrSelf.d.ts +0 -1
- package/dist/utils/misc/isDescendantOrSelf.js +0 -20
- package/dist/utils/misc/isDisabled.d.ts +0 -1
- package/dist/utils/misc/isDisabled.js +0 -12
- package/dist/utils/misc/isElementType.d.ts +0 -5
- package/dist/utils/misc/isElementType.js +0 -24
- package/dist/utils/misc/isVisible.d.ts +0 -1
- package/dist/utils/misc/isVisible.js +0 -31
- package/dist/utils/misc/wait.d.ts +0 -1
- package/dist/utils/misc/wait.js +0 -10
- package/dist/utils/pointer/firePointerEvents.d.ts +0 -25
- package/dist/utils/pointer/firePointerEvents.js +0 -110
- package/dist/utils/pointer/mouseButtons.d.ts +0 -12
- package/dist/utils/pointer/mouseButtons.js +0 -45
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,1110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
declare module "utils/misc/isElementType" {
|
|
2
|
+
type tag = keyof HTMLElementTagNameMap;
|
|
3
|
+
export function isElementType<T extends tag, P extends {
|
|
4
|
+
[k: string]: unknown;
|
|
5
|
+
} | undefined = undefined>(element: Element, tag: T | T[], props?: P): element is P extends undefined ? HTMLElementTagNameMap[T] : HTMLElementTagNameMap[T] & P;
|
|
6
|
+
}
|
|
7
|
+
declare module "utils/click/isClickableInput" {
|
|
8
|
+
export function isClickableInput(element: Element): boolean;
|
|
9
|
+
}
|
|
10
|
+
declare module "utils/dataTransfer/Blob" {
|
|
11
|
+
export function readBlobText(blob: Blob): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
declare module "utils/dataTransfer/FileList" {
|
|
14
|
+
export function createFileList(files: File[]): FileList;
|
|
15
|
+
}
|
|
16
|
+
declare module "utils/dataTransfer/DataTransfer" {
|
|
17
|
+
export function createDataTransfer(files?: File[]): DataTransfer;
|
|
18
|
+
export function getBlobFromDataTransferItem(item: DataTransferItem): Blob;
|
|
19
|
+
}
|
|
20
|
+
declare module "utils/dataTransfer/Clipboard" {
|
|
21
|
+
export function createClipboardItem(...blobs: Array<Blob | string>): ClipboardItem;
|
|
22
|
+
export function attachClipboardStubToView(window: Window & typeof globalThis): {
|
|
23
|
+
resetClipboardStub: () => void;
|
|
24
|
+
detachClipboardStub: () => void;
|
|
25
|
+
};
|
|
26
|
+
export function resetClipboardStubOnView(window: Window & typeof globalThis): void;
|
|
27
|
+
export function detachClipboardStubFromView(window: Window & typeof globalThis): void;
|
|
28
|
+
export function readDataTransferFromClipboard(document: Document): Promise<DataTransfer>;
|
|
29
|
+
export function writeDataTransferToClipboard(document: Document, clipboardData: DataTransfer): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
declare module "utils/edit/buildTimeValue" {
|
|
32
|
+
export function buildTimeValue(value: string): string;
|
|
33
|
+
}
|
|
34
|
+
declare module "document/interceptor" {
|
|
35
|
+
type anyFunc = (...a: any[]) => any;
|
|
36
|
+
type Params<Prop> = Prop extends anyFunc ? Parameters<Prop> : [Prop];
|
|
37
|
+
type ImplReturn<Prop> = Prop extends anyFunc ? Parameters<Prop> : Prop;
|
|
38
|
+
export function prepareInterceptor<ElementType extends Node, PropName extends keyof ElementType>(element: ElementType, propName: PropName, interceptorImpl: (this: ElementType, ...args: Params<ElementType[PropName]>) => {
|
|
39
|
+
/**
|
|
40
|
+
* React tracks the changes on element properties.
|
|
41
|
+
* This workaround tries to alter the DOM element without React noticing,
|
|
42
|
+
* so that it later picks up the change.
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/facebook/react/blob/148f8e497c7d37a3c7ab99f01dec2692427272b1/packages/react-dom/src/client/inputValueTracking.js#L51-L104
|
|
45
|
+
*/
|
|
46
|
+
applyNative?: boolean;
|
|
47
|
+
realArgs?: ImplReturn<ElementType[PropName]>;
|
|
48
|
+
}): void;
|
|
49
|
+
}
|
|
50
|
+
declare module "document/selection" {
|
|
51
|
+
const UISelection: unique symbol;
|
|
52
|
+
export interface UISelectionRange {
|
|
53
|
+
startOffset: number;
|
|
54
|
+
endOffset: number;
|
|
55
|
+
}
|
|
56
|
+
export interface UISelection {
|
|
57
|
+
anchorOffset: number;
|
|
58
|
+
focusOffset: number;
|
|
59
|
+
}
|
|
60
|
+
global {
|
|
61
|
+
interface Element {
|
|
62
|
+
[UISelection]?: UISelection;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function prepareSelectionInterceptor(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
66
|
+
export function setUISelection(element: HTMLInputElement | HTMLTextAreaElement, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam, }: {
|
|
67
|
+
anchorOffset?: number;
|
|
68
|
+
focusOffset: number;
|
|
69
|
+
}, mode?: 'replace' | 'modify'): void;
|
|
70
|
+
export function getUISelection(element: HTMLInputElement | HTMLTextAreaElement): {
|
|
71
|
+
startOffset: number;
|
|
72
|
+
endOffset: number;
|
|
73
|
+
anchorOffset: number;
|
|
74
|
+
focusOffset: number;
|
|
75
|
+
};
|
|
76
|
+
export function clearUISelection(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
77
|
+
}
|
|
78
|
+
declare module "document/value" {
|
|
79
|
+
const UIValue: unique symbol;
|
|
80
|
+
const InitialValue: unique symbol;
|
|
81
|
+
const TrackChanges: unique symbol;
|
|
82
|
+
global {
|
|
83
|
+
interface Element {
|
|
84
|
+
[UIValue]?: string;
|
|
85
|
+
[InitialValue]?: string;
|
|
86
|
+
[TrackChanges]?: string[];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export function prepareValueInterceptor(element: HTMLInputElement): void;
|
|
90
|
+
export function setUIValue(element: HTMLInputElement | HTMLTextAreaElement, value: string): void;
|
|
91
|
+
export function getUIValue(element: HTMLInputElement | HTMLTextAreaElement): string;
|
|
92
|
+
export function setInitialValue(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
93
|
+
export function getInitialValue(element: HTMLInputElement | HTMLTextAreaElement): string | undefined;
|
|
94
|
+
export function startTrackValue(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
95
|
+
export function endTrackValue(element: HTMLInputElement | HTMLTextAreaElement): string[] | undefined;
|
|
96
|
+
}
|
|
97
|
+
declare module "document/index" {
|
|
98
|
+
const isPrepared: unique symbol;
|
|
99
|
+
global {
|
|
100
|
+
interface Node {
|
|
101
|
+
[isPrepared]?: typeof isPrepared;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export function prepareDocument(document: Document): void;
|
|
105
|
+
export { getUIValue, setUIValue, startTrackValue, endTrackValue } from "document/value";
|
|
106
|
+
export { getUISelection, setUISelection } from "document/selection";
|
|
107
|
+
export type { UISelectionRange } from "document/selection";
|
|
108
|
+
}
|
|
109
|
+
declare module "utils/edit/isContentEditable" {
|
|
110
|
+
export function isContentEditable(element: Element): element is HTMLElement & {
|
|
111
|
+
contenteditable: 'true';
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* If a node is a contenteditable or inside one, return that element.
|
|
115
|
+
*/
|
|
116
|
+
export function getContentEditable(node: Node): Element | null;
|
|
117
|
+
}
|
|
118
|
+
declare module "utils/edit/isEditable" {
|
|
119
|
+
import { isContentEditable } from "utils/edit/isContentEditable";
|
|
120
|
+
type GuardedType<T> = T extends (x: any) => x is infer R ? R : never;
|
|
121
|
+
export function isEditable(element: Element): element is GuardedType<typeof isContentEditable> | GuardedType<typeof isEditableInput> | (HTMLTextAreaElement & {
|
|
122
|
+
readOnly: false;
|
|
123
|
+
});
|
|
124
|
+
export enum editableInputTypes {
|
|
125
|
+
'text' = "text",
|
|
126
|
+
'date' = "date",
|
|
127
|
+
'datetime-local' = "datetime-local",
|
|
128
|
+
'email' = "email",
|
|
129
|
+
'month' = "month",
|
|
130
|
+
'number' = "number",
|
|
131
|
+
'password' = "password",
|
|
132
|
+
'search' = "search",
|
|
133
|
+
'tel' = "tel",
|
|
134
|
+
'time' = "time",
|
|
135
|
+
'url' = "url",
|
|
136
|
+
'week' = "week"
|
|
137
|
+
}
|
|
138
|
+
export type EditableInputType = keyof typeof editableInputTypes;
|
|
139
|
+
export function isEditableInput(element: Element): element is HTMLInputElement & {
|
|
140
|
+
readOnly: false;
|
|
141
|
+
type: editableInputTypes;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
declare module "utils/edit/isValidDateValue" {
|
|
145
|
+
export function isValidDateValue(element: HTMLInputElement & {
|
|
146
|
+
type: 'date';
|
|
147
|
+
}, value: string): boolean;
|
|
148
|
+
}
|
|
149
|
+
declare module "utils/edit/isValidInputTimeValue" {
|
|
150
|
+
export function isValidInputTimeValue(element: HTMLInputElement & {
|
|
151
|
+
type: 'time';
|
|
152
|
+
}, timeValue: string): boolean;
|
|
153
|
+
}
|
|
154
|
+
declare module "utils/edit/calculateNewValue" {
|
|
155
|
+
import { EditableInputType } from "utils/edit/isEditable";
|
|
156
|
+
/**
|
|
157
|
+
* Calculate a new text value.
|
|
158
|
+
*/
|
|
159
|
+
export function calculateNewValue(inputData: string, node: (HTMLInputElement & {
|
|
160
|
+
type: EditableInputType;
|
|
161
|
+
}) | HTMLTextAreaElement, { startOffset, endOffset, }: {
|
|
162
|
+
startOffset: number;
|
|
163
|
+
endOffset: number;
|
|
164
|
+
}, inputType?: string): {
|
|
165
|
+
oldValue: string;
|
|
166
|
+
newValue: string;
|
|
167
|
+
newOffset: number;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
declare module "utils/focus/selection" {
|
|
171
|
+
import { UISelectionRange } from "document/index";
|
|
172
|
+
import { editableInputTypes } from "utils/edit/isEditable";
|
|
173
|
+
/**
|
|
174
|
+
* Backward-compatible selection.
|
|
175
|
+
*
|
|
176
|
+
* Handles input elements and contenteditable if it only contains a single text node.
|
|
177
|
+
*/
|
|
178
|
+
export function setSelectionRange(element: Element, anchorOffset: number, focusOffset: number): void;
|
|
179
|
+
/**
|
|
180
|
+
* Determine if the element has its own selection implementation
|
|
181
|
+
* and does not interact with the Document Selection API.
|
|
182
|
+
*/
|
|
183
|
+
export function hasOwnSelection(node: Node): node is HTMLTextAreaElement | (HTMLInputElement & {
|
|
184
|
+
type: editableInputTypes;
|
|
185
|
+
});
|
|
186
|
+
/**
|
|
187
|
+
* Reset the Document Selection when moving focus into an element
|
|
188
|
+
* with own selection implementation.
|
|
189
|
+
*/
|
|
190
|
+
export function updateSelectionOnFocus(element: Element): void;
|
|
191
|
+
/**
|
|
192
|
+
* Get the range that would be overwritten by input.
|
|
193
|
+
*/
|
|
194
|
+
export function getInputRange(focusNode: Node): UISelectionRange | Range | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
|
|
197
|
+
*/
|
|
198
|
+
export function modifySelection({ focusNode, focusOffset, }: {
|
|
199
|
+
focusNode: Node;
|
|
200
|
+
/** DOM Offset */
|
|
201
|
+
focusOffset: number;
|
|
202
|
+
}): void;
|
|
203
|
+
/**
|
|
204
|
+
* Set the selection
|
|
205
|
+
*/
|
|
206
|
+
export function setSelection({ focusNode, focusOffset, anchorNode, anchorOffset, }: {
|
|
207
|
+
anchorNode?: Node;
|
|
208
|
+
/** DOM offset */
|
|
209
|
+
anchorOffset?: number;
|
|
210
|
+
focusNode: Node;
|
|
211
|
+
focusOffset: number;
|
|
212
|
+
}): void;
|
|
213
|
+
}
|
|
214
|
+
declare module "utils/edit/editInputElement" {
|
|
215
|
+
import { fireEvent } from '@testing-library/dom';
|
|
216
|
+
/**
|
|
217
|
+
* Change the value of an element as if it was changed as a result of a user input.
|
|
218
|
+
*
|
|
219
|
+
* Fires the input event.
|
|
220
|
+
*/
|
|
221
|
+
export function editInputElement(element: HTMLInputElement | HTMLTextAreaElement, { newValue, newSelection, eventOverrides, }: {
|
|
222
|
+
newValue: string;
|
|
223
|
+
newSelection: {
|
|
224
|
+
node: Node;
|
|
225
|
+
offset: number;
|
|
226
|
+
};
|
|
227
|
+
eventOverrides: Partial<Parameters<typeof fireEvent>[1]> & {
|
|
228
|
+
[k: string]: unknown;
|
|
229
|
+
};
|
|
230
|
+
}): void;
|
|
231
|
+
}
|
|
232
|
+
declare module "utils/edit/getValue" {
|
|
233
|
+
export function getValue<T extends Element | null>(element: T): T extends HTMLInputElement | HTMLTextAreaElement ? string : string | null;
|
|
234
|
+
}
|
|
235
|
+
declare module "utils/edit/maxLength" {
|
|
236
|
+
export function getSpaceUntilMaxLength(element: Element): number | undefined;
|
|
237
|
+
}
|
|
238
|
+
declare module "utils/edit/prepareInput" {
|
|
239
|
+
export function prepareInput(data: string, element: Element, inputType?: string): {
|
|
240
|
+
commit: () => void;
|
|
241
|
+
getNewValue?: undefined;
|
|
242
|
+
} | {
|
|
243
|
+
getNewValue: () => string;
|
|
244
|
+
commit: () => void;
|
|
245
|
+
} | undefined;
|
|
246
|
+
}
|
|
247
|
+
declare module "utils/edit/setFiles" {
|
|
248
|
+
const fakeFiles: unique symbol;
|
|
249
|
+
global {
|
|
250
|
+
interface HTMLInputElement {
|
|
251
|
+
[fakeFiles]?: {
|
|
252
|
+
restore: () => void;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
export function setFiles(el: HTMLInputElement & {
|
|
257
|
+
type: 'file';
|
|
258
|
+
}, files: FileList): void;
|
|
259
|
+
}
|
|
260
|
+
declare module "utils/misc/eventWrapper" {
|
|
261
|
+
export function eventWrapper<T>(cb: () => T): T | undefined;
|
|
262
|
+
}
|
|
263
|
+
declare module "utils/misc/isDisabled" {
|
|
264
|
+
export function isDisabled(element: Element | null): boolean;
|
|
265
|
+
}
|
|
266
|
+
declare module "utils/focus/getActiveElement" {
|
|
267
|
+
export function getActiveElement(document: Document | ShadowRoot): Element | null;
|
|
268
|
+
}
|
|
269
|
+
declare module "utils/focus/selector" {
|
|
270
|
+
export const FOCUSABLE_SELECTOR: string;
|
|
271
|
+
}
|
|
272
|
+
declare module "utils/focus/isFocusable" {
|
|
273
|
+
export function isFocusable(element: Element): element is HTMLElement;
|
|
274
|
+
}
|
|
275
|
+
declare module "utils/focus/blur" {
|
|
276
|
+
function blur(element: Element): void;
|
|
277
|
+
export { blur };
|
|
278
|
+
}
|
|
279
|
+
declare module "utils/focus/copySelection" {
|
|
280
|
+
export function copySelection(target: Element): DataTransfer;
|
|
281
|
+
}
|
|
282
|
+
declare module "utils/focus/focus" {
|
|
283
|
+
function focus(element: Element): void;
|
|
284
|
+
export { focus };
|
|
285
|
+
}
|
|
286
|
+
declare module "utils/misc/isVisible" {
|
|
287
|
+
export function isVisible(element: Element): boolean;
|
|
288
|
+
}
|
|
289
|
+
declare module "utils/focus/getTabDestination" {
|
|
290
|
+
export function getTabDestination(activeElement: Element, shift: boolean): HTMLElement;
|
|
291
|
+
}
|
|
292
|
+
declare module "utils/focus/selectAll" {
|
|
293
|
+
/**
|
|
294
|
+
* Expand a selection like the browser does when pressing Ctrl+A.
|
|
295
|
+
*/
|
|
296
|
+
export function selectAll(target: Element): void;
|
|
297
|
+
export function isAllSelected(target: Element): boolean;
|
|
298
|
+
}
|
|
299
|
+
declare module "keyboard/types" {
|
|
300
|
+
import { Config } from "setup/index";
|
|
301
|
+
/**
|
|
302
|
+
* @internal Do not create/alter this by yourself as this type might be subject to changes.
|
|
303
|
+
*/
|
|
304
|
+
export type keyboardState = {
|
|
305
|
+
/**
|
|
306
|
+
All keys that have been pressed and not been lifted up yet.
|
|
307
|
+
*/
|
|
308
|
+
pressed: {
|
|
309
|
+
keyDef: keyboardKey;
|
|
310
|
+
unpreventedDefault: boolean;
|
|
311
|
+
}[];
|
|
312
|
+
/**
|
|
313
|
+
Active modifiers
|
|
314
|
+
*/
|
|
315
|
+
modifiers: {
|
|
316
|
+
Alt: boolean;
|
|
317
|
+
AltGraph: boolean;
|
|
318
|
+
CapsLock: boolean;
|
|
319
|
+
Control: boolean;
|
|
320
|
+
Fn: boolean;
|
|
321
|
+
FnLock: boolean;
|
|
322
|
+
Meta: boolean;
|
|
323
|
+
NumLock: boolean;
|
|
324
|
+
ScrollLock: boolean;
|
|
325
|
+
Shift: boolean;
|
|
326
|
+
Symbol: boolean;
|
|
327
|
+
SymbolLock: boolean;
|
|
328
|
+
};
|
|
329
|
+
modifierPhase: {
|
|
330
|
+
CapsLock?: boolean;
|
|
331
|
+
FnLock?: boolean;
|
|
332
|
+
NumLock?: boolean;
|
|
333
|
+
ScrollLock?: boolean;
|
|
334
|
+
SymbolLock?: boolean;
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
The element the keyboard input is performed on.
|
|
338
|
+
Some behavior might differ if the activeElement changes between corresponding keyboard events.
|
|
339
|
+
*/
|
|
340
|
+
activeElement: Element | null;
|
|
341
|
+
/**
|
|
342
|
+
For HTMLInputElements type='number':
|
|
343
|
+
If the last input char is '.', '-' or 'e',
|
|
344
|
+
the IDL value attribute does not reflect the input value.
|
|
345
|
+
|
|
346
|
+
@deprecated The document state workaround in `src/document/value.ts` keeps track
|
|
347
|
+
of UI value diverging from value property.
|
|
348
|
+
*/
|
|
349
|
+
carryValue?: string;
|
|
350
|
+
/**
|
|
351
|
+
Carry over characters to following key handlers.
|
|
352
|
+
E.g. ^1
|
|
353
|
+
*/
|
|
354
|
+
carryChar: string;
|
|
355
|
+
};
|
|
356
|
+
export enum DOM_KEY_LOCATION {
|
|
357
|
+
STANDARD = 0,
|
|
358
|
+
LEFT = 1,
|
|
359
|
+
RIGHT = 2,
|
|
360
|
+
NUMPAD = 3
|
|
361
|
+
}
|
|
362
|
+
export interface keyboardKey {
|
|
363
|
+
/** Physical location on a keyboard */
|
|
364
|
+
code?: string;
|
|
365
|
+
/** Character or functional key descriptor */
|
|
366
|
+
key?: string;
|
|
367
|
+
/** Location on the keyboard for keys with multiple representation */
|
|
368
|
+
location?: DOM_KEY_LOCATION;
|
|
369
|
+
/** Does the character in `key` require/imply AltRight to be pressed? */
|
|
370
|
+
altGr?: boolean;
|
|
371
|
+
/** Does the character in `key` require/imply a shiftKey to be pressed? */
|
|
372
|
+
shift?: boolean;
|
|
373
|
+
}
|
|
374
|
+
export interface behaviorPlugin {
|
|
375
|
+
matches: (keyDef: keyboardKey, element: Element, config: Config) => boolean;
|
|
376
|
+
handle: (keyDef: keyboardKey, element: Element, config: Config) => void;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
declare module "keyboard/plugins/arrow" {
|
|
380
|
+
/**
|
|
381
|
+
* This file should contain behavior for arrow keys as described here:
|
|
382
|
+
* https://w3c.github.io/uievents-code/#key-arrowpad-section
|
|
383
|
+
*/
|
|
384
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
385
|
+
export const keydownBehavior: behaviorPlugin[];
|
|
386
|
+
}
|
|
387
|
+
declare module "keyboard/plugins/control" {
|
|
388
|
+
/**
|
|
389
|
+
* This file should contain behavior for arrow keys as described here:
|
|
390
|
+
* https://w3c.github.io/uievents-code/#key-controlpad-section
|
|
391
|
+
*/
|
|
392
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
393
|
+
export const keydownBehavior: behaviorPlugin[];
|
|
394
|
+
}
|
|
395
|
+
declare module "keyboard/shared/fireChangeForInputTimeIfValid" {
|
|
396
|
+
export function fireChangeForInputTimeIfValid(el: HTMLInputElement & {
|
|
397
|
+
type: 'time';
|
|
398
|
+
}, prevValue: unknown, timeNewEntry: string): void;
|
|
399
|
+
}
|
|
400
|
+
declare module "keyboard/shared/index" {
|
|
401
|
+
export * from "keyboard/shared/fireChangeForInputTimeIfValid";
|
|
402
|
+
}
|
|
403
|
+
declare module "keyboard/plugins/character" {
|
|
404
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
405
|
+
export const keypressBehavior: behaviorPlugin[];
|
|
406
|
+
}
|
|
407
|
+
declare module "keyboard/plugins/functional" {
|
|
408
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
409
|
+
export const keydownBehavior: behaviorPlugin[];
|
|
410
|
+
export const keypressBehavior: behaviorPlugin[];
|
|
411
|
+
export const keyupBehavior: behaviorPlugin[];
|
|
412
|
+
}
|
|
413
|
+
declare module "keyboard/plugins/combination" {
|
|
414
|
+
/**
|
|
415
|
+
* Default behavior for key combinations
|
|
416
|
+
*/
|
|
417
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
418
|
+
export const keydownBehavior: behaviorPlugin[];
|
|
419
|
+
}
|
|
420
|
+
declare module "keyboard/plugins/modifiers" {
|
|
421
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
422
|
+
export const preKeydownBehavior: behaviorPlugin[];
|
|
423
|
+
export const preKeyupBehavior: behaviorPlugin[];
|
|
424
|
+
export const postKeyupBehavior: behaviorPlugin[];
|
|
425
|
+
}
|
|
426
|
+
declare module "keyboard/plugins/index" {
|
|
427
|
+
import { behaviorPlugin } from "keyboard/types";
|
|
428
|
+
export const preKeydownBehavior: behaviorPlugin[];
|
|
429
|
+
export const keydownBehavior: behaviorPlugin[];
|
|
430
|
+
export const keypressBehavior: behaviorPlugin[];
|
|
431
|
+
export const preKeyupBehavior: behaviorPlugin[];
|
|
432
|
+
export const keyupBehavior: behaviorPlugin[];
|
|
433
|
+
export const postKeyupBehavior: behaviorPlugin[];
|
|
434
|
+
}
|
|
435
|
+
declare module "keyboard/keyboardAction" {
|
|
436
|
+
import { Config } from "setup/index";
|
|
437
|
+
import { keyboardKey } from "keyboard/types";
|
|
438
|
+
export interface KeyboardAction {
|
|
439
|
+
keyDef: keyboardKey;
|
|
440
|
+
releasePrevious: boolean;
|
|
441
|
+
releaseSelf: boolean;
|
|
442
|
+
repeat: number;
|
|
443
|
+
}
|
|
444
|
+
export function keyboardAction(config: Config, actions: KeyboardAction[]): Promise<void>;
|
|
445
|
+
export function releaseAllKeys(config: Config): Promise<void>;
|
|
446
|
+
}
|
|
447
|
+
declare module "keyboard/parseKeyDef" {
|
|
448
|
+
import { keyboardKey } from "keyboard/types";
|
|
449
|
+
/**
|
|
450
|
+
* Parse key defintions per `keyboardMap`
|
|
451
|
+
*
|
|
452
|
+
* Keys can be referenced by `{key}` or `{special}` as well as physical locations per `[code]`.
|
|
453
|
+
* Everything else will be interpreted as a typed character - e.g. `a`.
|
|
454
|
+
* Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
|
|
455
|
+
* Keeping the key pressed can be written as `{key>}`.
|
|
456
|
+
* When keeping the key pressed you can choose how long (how many keydown and keypress) the key is pressed `{key>3}`.
|
|
457
|
+
* You can then release the key per `{key>3/}` or keep it pressed and continue with the next key.
|
|
458
|
+
*/
|
|
459
|
+
export function parseKeyDef(keyboardMap: keyboardKey[], text: string): {
|
|
460
|
+
keyDef: keyboardKey;
|
|
461
|
+
releasePrevious: boolean;
|
|
462
|
+
releaseSelf: boolean;
|
|
463
|
+
repeat: number;
|
|
464
|
+
}[];
|
|
465
|
+
}
|
|
466
|
+
declare module "keyboard/index" {
|
|
467
|
+
import { UserEvent } from "setup/index";
|
|
468
|
+
import { releaseAllKeys } from "keyboard/keyboardAction";
|
|
469
|
+
import type { keyboardState, keyboardKey } from "keyboard/types";
|
|
470
|
+
export { releaseAllKeys };
|
|
471
|
+
export type { keyboardKey, keyboardState };
|
|
472
|
+
export function keyboard(this: UserEvent, text: string): Promise<void>;
|
|
473
|
+
export function createKeyboardState(): keyboardState;
|
|
474
|
+
}
|
|
475
|
+
declare module "utils/keyboard/getUIEventModifiers" {
|
|
476
|
+
import type { keyboardState } from "keyboard/index";
|
|
477
|
+
export function getUIEventModifiers(keyboardState: keyboardState): {
|
|
478
|
+
altKey: boolean;
|
|
479
|
+
ctrlKey: boolean;
|
|
480
|
+
metaKey: boolean;
|
|
481
|
+
shiftKey: boolean;
|
|
482
|
+
modifierAltGraph: boolean;
|
|
483
|
+
modifierCapsLock: boolean;
|
|
484
|
+
modifierFn: boolean;
|
|
485
|
+
modifierFnLock: boolean;
|
|
486
|
+
modifierNumLock: boolean;
|
|
487
|
+
modifierScrollLock: boolean;
|
|
488
|
+
modifierSymbol: boolean;
|
|
489
|
+
modifierSymbolLock: boolean;
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
declare module "utils/keyboard/getKeyEventProps" {
|
|
493
|
+
import { keyboardKey, keyboardState } from "keyboard/types";
|
|
494
|
+
export function getKeyEventProps(keyDef: keyboardKey, state: keyboardState): {
|
|
495
|
+
altKey: boolean;
|
|
496
|
+
ctrlKey: boolean;
|
|
497
|
+
metaKey: boolean;
|
|
498
|
+
shiftKey: boolean;
|
|
499
|
+
modifierAltGraph: boolean;
|
|
500
|
+
modifierCapsLock: boolean;
|
|
501
|
+
modifierFn: boolean;
|
|
502
|
+
modifierFnLock: boolean;
|
|
503
|
+
modifierNumLock: boolean;
|
|
504
|
+
modifierScrollLock: boolean;
|
|
505
|
+
modifierSymbol: boolean;
|
|
506
|
+
modifierSymbolLock: boolean;
|
|
507
|
+
key: string | undefined;
|
|
508
|
+
code: string | undefined;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
declare module "utils/keyDef/readNextDescriptor" {
|
|
512
|
+
/**
|
|
513
|
+
* Read the next key definition from user input
|
|
514
|
+
*
|
|
515
|
+
* Describe key per `{descriptor}` or `[descriptor]`.
|
|
516
|
+
* Everything else will be interpreted as a single character as descriptor - e.g. `a`.
|
|
517
|
+
* Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
|
|
518
|
+
* A previously pressed key can be released per `{/descriptor}`.
|
|
519
|
+
* Keeping the key pressed can be written as `{descriptor>}`.
|
|
520
|
+
* When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
|
|
521
|
+
* You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
|
|
522
|
+
*/
|
|
523
|
+
export function readNextDescriptor(text: string): {
|
|
524
|
+
consumedLength: number;
|
|
525
|
+
descriptor: string;
|
|
526
|
+
releasePrevious: boolean;
|
|
527
|
+
repeat: number;
|
|
528
|
+
releaseSelf: boolean | undefined;
|
|
529
|
+
type: string;
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
declare module "utils/misc/findClosest" {
|
|
533
|
+
export function findClosest(element: Element, callback: (e: Element) => boolean): Element | undefined;
|
|
534
|
+
}
|
|
535
|
+
declare module "utils/misc/getDocumentFromNode" {
|
|
536
|
+
export function getDocumentFromNode(el: Node): Document | null;
|
|
537
|
+
}
|
|
538
|
+
declare module "utils/misc/isDescendantOrSelf" {
|
|
539
|
+
export function isDescendantOrSelf(potentialDescendant: Element, potentialAncestor: Element): boolean;
|
|
540
|
+
}
|
|
541
|
+
declare module "utils/misc/wait" {
|
|
542
|
+
export function wait(time?: number): Promise<void>;
|
|
543
|
+
}
|
|
544
|
+
declare module "utils/misc/hasPointerEvents" {
|
|
545
|
+
/**
|
|
546
|
+
* Options that can be passed to any event that relies
|
|
547
|
+
* on pointer-events property
|
|
548
|
+
*/
|
|
549
|
+
export interface PointerOptions {
|
|
550
|
+
/**
|
|
551
|
+
* When set to `true` the event skips checking if any element
|
|
552
|
+
* in the DOM-tree has `'pointer-events: none'` set. This check is
|
|
553
|
+
* costly in general and very costly when rendering large DOM-trees.
|
|
554
|
+
* Can be used to speed up tests.
|
|
555
|
+
* Default: `false`
|
|
556
|
+
* */
|
|
557
|
+
skipPointerEventsCheck?: boolean;
|
|
558
|
+
}
|
|
559
|
+
export function hasPointerEvents(element: Element): boolean;
|
|
560
|
+
}
|
|
561
|
+
declare module "utils/misc/hasFormSubmit" {
|
|
562
|
+
export const hasFormSubmit: (form: HTMLFormElement | null) => form is HTMLFormElement;
|
|
563
|
+
}
|
|
564
|
+
declare module "pointer/types" {
|
|
565
|
+
import { PointerCoords, MouseButton } from "utils/index";
|
|
566
|
+
/**
|
|
567
|
+
* @internal Do not create/alter this by yourself as this type might be subject to changes.
|
|
568
|
+
*/
|
|
569
|
+
export type pointerState = {
|
|
570
|
+
/**
|
|
571
|
+
All keys that have been pressed and not been lifted up yet.
|
|
572
|
+
*/
|
|
573
|
+
pressed: {
|
|
574
|
+
keyDef: pointerKey;
|
|
575
|
+
pointerId: number;
|
|
576
|
+
isMultiTouch: boolean;
|
|
577
|
+
isPrimary: boolean;
|
|
578
|
+
clickCount: number;
|
|
579
|
+
unpreventedDefault: boolean;
|
|
580
|
+
/** Target the key was pressed on */
|
|
581
|
+
downTarget: Element;
|
|
582
|
+
}[];
|
|
583
|
+
activeClickCount?: [string, number];
|
|
584
|
+
/**
|
|
585
|
+
* Position of each pointer.
|
|
586
|
+
* The mouse is always pointer 1 and keeps its position.
|
|
587
|
+
* Pen and touch devices receive a new pointerId for every interaction.
|
|
588
|
+
*/
|
|
589
|
+
position: Record<string, {
|
|
590
|
+
pointerId: number;
|
|
591
|
+
pointerType: 'mouse' | 'pen' | 'touch';
|
|
592
|
+
} & Partial<PointerTarget> & {
|
|
593
|
+
selectionRange?: Range | SelectionInputRange;
|
|
594
|
+
}>;
|
|
595
|
+
/**
|
|
596
|
+
* Last applied pointer id
|
|
597
|
+
*/
|
|
598
|
+
pointerId: number;
|
|
599
|
+
};
|
|
600
|
+
export interface pointerKey {
|
|
601
|
+
/** Name of the pointer key */
|
|
602
|
+
name: string;
|
|
603
|
+
/** Type of the pointer device */
|
|
604
|
+
pointerType: 'mouse' | 'pen' | 'touch';
|
|
605
|
+
/** Type of button */
|
|
606
|
+
button?: MouseButton;
|
|
607
|
+
}
|
|
608
|
+
export interface PointerTarget {
|
|
609
|
+
target: Element;
|
|
610
|
+
coords?: PointerCoords;
|
|
611
|
+
}
|
|
612
|
+
export interface SelectionTarget {
|
|
613
|
+
node?: Node;
|
|
614
|
+
/**
|
|
615
|
+
* If `node` is set, this is the DOM offset.
|
|
616
|
+
* Otherwise this is the `textContent`/`value` offset on the `target`.
|
|
617
|
+
*/
|
|
618
|
+
offset?: number;
|
|
619
|
+
}
|
|
620
|
+
/** Describes a selection inside `HTMLInputElement`/`HTMLTextareaElement` */
|
|
621
|
+
export interface SelectionInputRange {
|
|
622
|
+
node: HTMLInputElement | HTMLTextAreaElement;
|
|
623
|
+
start: number;
|
|
624
|
+
end: number;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
declare module "utils/pointer/mouseButtons" {
|
|
628
|
+
export const MouseButton: {
|
|
629
|
+
readonly primary: 0;
|
|
630
|
+
readonly secondary: 1;
|
|
631
|
+
readonly auxiliary: 2;
|
|
632
|
+
readonly back: 3;
|
|
633
|
+
readonly X1: 3;
|
|
634
|
+
readonly forward: 4;
|
|
635
|
+
readonly X2: 4;
|
|
636
|
+
};
|
|
637
|
+
export type MouseButton = keyof typeof MouseButton | number;
|
|
638
|
+
export function getMouseButton(button: MouseButton): number;
|
|
639
|
+
export function getMouseButtons(...buttons: Array<MouseButton>): number;
|
|
640
|
+
}
|
|
641
|
+
declare module "utils/pointer/firePointerEvents" {
|
|
642
|
+
import type { pointerState } from "pointer/types";
|
|
643
|
+
import type { keyboardState } from "keyboard/types";
|
|
644
|
+
import { MouseButton } from "utils/pointer/mouseButtons";
|
|
645
|
+
export function firePointerEvent(target: Element, type: string, { pointerState, keyboardState, pointerType, button, coords, pointerId, isPrimary, clickCount, }: {
|
|
646
|
+
pointerState: pointerState;
|
|
647
|
+
keyboardState: keyboardState;
|
|
648
|
+
pointerType?: 'mouse' | 'pen' | 'touch';
|
|
649
|
+
button?: MouseButton;
|
|
650
|
+
coords?: PointerCoords;
|
|
651
|
+
pointerId?: number;
|
|
652
|
+
isPrimary?: boolean;
|
|
653
|
+
clickCount?: number;
|
|
654
|
+
}): boolean;
|
|
655
|
+
export interface PointerCoords {
|
|
656
|
+
x?: number;
|
|
657
|
+
y?: number;
|
|
658
|
+
clientX?: number;
|
|
659
|
+
clientY?: number;
|
|
660
|
+
offsetX?: number;
|
|
661
|
+
offsetY?: number;
|
|
662
|
+
pageX?: number;
|
|
663
|
+
pageY?: number;
|
|
664
|
+
screenX?: number;
|
|
665
|
+
screenY?: number;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
declare module "utils/index" {
|
|
669
|
+
export * from "utils/click/isClickableInput";
|
|
670
|
+
export * from "utils/dataTransfer/Blob";
|
|
671
|
+
export * from "utils/dataTransfer/DataTransfer";
|
|
672
|
+
export * from "utils/dataTransfer/FileList";
|
|
673
|
+
export * from "utils/dataTransfer/Clipboard";
|
|
674
|
+
export * from "utils/edit/buildTimeValue";
|
|
675
|
+
export * from "utils/edit/calculateNewValue";
|
|
676
|
+
export * from "utils/edit/editInputElement";
|
|
677
|
+
export * from "utils/edit/getValue";
|
|
678
|
+
export * from "utils/edit/isContentEditable";
|
|
679
|
+
export * from "utils/edit/isEditable";
|
|
680
|
+
export * from "utils/edit/isValidDateValue";
|
|
681
|
+
export * from "utils/edit/isValidInputTimeValue";
|
|
682
|
+
export * from "utils/edit/maxLength";
|
|
683
|
+
export * from "utils/edit/prepareInput";
|
|
684
|
+
export * from "utils/edit/setFiles";
|
|
685
|
+
export * from "utils/focus/blur";
|
|
686
|
+
export * from "utils/focus/copySelection";
|
|
687
|
+
export * from "utils/focus/focus";
|
|
688
|
+
export * from "utils/focus/getActiveElement";
|
|
689
|
+
export * from "utils/focus/getTabDestination";
|
|
690
|
+
export * from "utils/focus/isFocusable";
|
|
691
|
+
export * from "utils/focus/selectAll";
|
|
692
|
+
export * from "utils/focus/selection";
|
|
693
|
+
export * from "utils/focus/selector";
|
|
694
|
+
export * from "utils/keyboard/getKeyEventProps";
|
|
695
|
+
export * from "utils/keyboard/getUIEventModifiers";
|
|
696
|
+
export * from "utils/keyDef/readNextDescriptor";
|
|
697
|
+
export * from "utils/misc/eventWrapper";
|
|
698
|
+
export * from "utils/misc/findClosest";
|
|
699
|
+
export * from "utils/misc/getDocumentFromNode";
|
|
700
|
+
export * from "utils/misc/isDescendantOrSelf";
|
|
701
|
+
export * from "utils/misc/isElementType";
|
|
702
|
+
export * from "utils/misc/isVisible";
|
|
703
|
+
export * from "utils/misc/isDisabled";
|
|
704
|
+
export * from "utils/misc/wait";
|
|
705
|
+
export * from "utils/misc/hasPointerEvents";
|
|
706
|
+
export * from "utils/misc/hasFormSubmit";
|
|
707
|
+
export * from "utils/pointer/firePointerEvents";
|
|
708
|
+
export * from "utils/pointer/mouseButtons";
|
|
709
|
+
}
|
|
710
|
+
declare module "pointer/parseKeyDef" {
|
|
711
|
+
import { pointerKey } from "pointer/types";
|
|
712
|
+
export function parseKeyDef(pointerMap: pointerKey[], keys: string): {
|
|
713
|
+
keyDef: pointerKey;
|
|
714
|
+
releasePrevious: boolean;
|
|
715
|
+
releaseSelf: boolean;
|
|
716
|
+
}[];
|
|
717
|
+
}
|
|
718
|
+
declare module "pointer/resolveSelectionTarget" {
|
|
719
|
+
import { PointerTarget, SelectionTarget } from "pointer/types";
|
|
720
|
+
export function resolveSelectionTarget({ target, node, offset, }: PointerTarget & SelectionTarget): {
|
|
721
|
+
node: Node;
|
|
722
|
+
offset: number;
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
declare module "pointer/pointerMove" {
|
|
726
|
+
import { inputDeviceState } from "setup/index";
|
|
727
|
+
import { PointerTarget, SelectionTarget } from "pointer/types";
|
|
728
|
+
export interface PointerMoveAction extends PointerTarget, SelectionTarget {
|
|
729
|
+
pointerName?: string;
|
|
730
|
+
}
|
|
731
|
+
export function pointerMove({ pointerName, target, coords, node, offset }: PointerMoveAction, { pointerState, keyboardState }: inputDeviceState): Promise<void>;
|
|
732
|
+
}
|
|
733
|
+
declare module "pointer/pointerPress" {
|
|
734
|
+
import { inputDeviceState } from "setup/index";
|
|
735
|
+
import type { pointerKey, PointerTarget, SelectionTarget } from "pointer/types";
|
|
736
|
+
export interface PointerPressAction extends PointerTarget, SelectionTarget {
|
|
737
|
+
keyDef: pointerKey;
|
|
738
|
+
releasePrevious: boolean;
|
|
739
|
+
releaseSelf: boolean;
|
|
740
|
+
}
|
|
741
|
+
export function pointerPress(action: PointerPressAction, state: inputDeviceState): Promise<void>;
|
|
742
|
+
}
|
|
743
|
+
declare module "pointer/pointerAction" {
|
|
744
|
+
import { Config } from "setup/index";
|
|
745
|
+
import { PointerMoveAction } from "pointer/pointerMove";
|
|
746
|
+
import { PointerPressAction } from "pointer/pointerPress";
|
|
747
|
+
import { PointerTarget, SelectionTarget } from "pointer/types";
|
|
748
|
+
export type PointerActionTarget = Partial<PointerTarget> & Partial<SelectionTarget>;
|
|
749
|
+
export type PointerAction = PointerActionTarget & (Omit<PointerPressAction, 'target' | 'coords'> | Omit<PointerMoveAction, 'target' | 'coords'>);
|
|
750
|
+
export function pointerAction(config: Config, actions: PointerAction[]): Promise<void>;
|
|
751
|
+
}
|
|
752
|
+
declare module "pointer/index" {
|
|
753
|
+
import { UserEvent } from "setup/index";
|
|
754
|
+
import { PointerAction, PointerActionTarget } from "pointer/pointerAction";
|
|
755
|
+
import type { pointerState, pointerKey } from "pointer/types";
|
|
756
|
+
export type { pointerState, pointerKey };
|
|
757
|
+
type PointerActionInput = string | ({
|
|
758
|
+
keys: string;
|
|
759
|
+
} & PointerActionTarget) | PointerAction;
|
|
760
|
+
export type PointerInput = PointerActionInput | Array<PointerActionInput>;
|
|
761
|
+
export function pointer(this: UserEvent, input: PointerInput): Promise<void>;
|
|
762
|
+
export function createPointerState(document: Document): pointerState;
|
|
763
|
+
}
|
|
764
|
+
declare module "convenience/click" {
|
|
765
|
+
import { UserEvent } from "setup/index";
|
|
766
|
+
export function click(this: UserEvent, element: Element): Promise<void>;
|
|
767
|
+
export function dblClick(this: UserEvent, element: Element): Promise<void>;
|
|
768
|
+
export function tripleClick(this: UserEvent, element: Element): Promise<void>;
|
|
769
|
+
}
|
|
770
|
+
declare module "convenience/hover" {
|
|
771
|
+
import { UserEvent } from "setup/index";
|
|
772
|
+
export function hover(this: UserEvent, element: Element): Promise<void>;
|
|
773
|
+
export function unhover(this: UserEvent, element: Element): Promise<void>;
|
|
774
|
+
}
|
|
775
|
+
declare module "convenience/tab" {
|
|
776
|
+
import type { UserEvent } from "setup/index";
|
|
777
|
+
export function tab(this: UserEvent, { shift, }?: {
|
|
778
|
+
shift?: boolean;
|
|
779
|
+
}): Promise<void>;
|
|
780
|
+
}
|
|
781
|
+
declare module "convenience/index" {
|
|
782
|
+
export * from "convenience/click";
|
|
783
|
+
export * from "convenience/hover";
|
|
784
|
+
export * from "convenience/tab";
|
|
785
|
+
}
|
|
786
|
+
declare module "clipboard/copy" {
|
|
787
|
+
import { UserEvent } from "setup/index";
|
|
788
|
+
export function copy(this: UserEvent): Promise<DataTransfer | undefined>;
|
|
789
|
+
}
|
|
790
|
+
declare module "clipboard/cut" {
|
|
791
|
+
import { UserEvent } from "setup/index";
|
|
792
|
+
export function cut(this: UserEvent): Promise<DataTransfer | undefined>;
|
|
793
|
+
}
|
|
794
|
+
declare module "clipboard/paste" {
|
|
795
|
+
import { UserEvent } from "setup/index";
|
|
796
|
+
export function paste(this: UserEvent, clipboardData?: DataTransfer | string): Promise<void>;
|
|
797
|
+
}
|
|
798
|
+
declare module "clipboard/index" {
|
|
799
|
+
export * from "clipboard/copy";
|
|
800
|
+
export * from "clipboard/cut";
|
|
801
|
+
export * from "clipboard/paste";
|
|
802
|
+
}
|
|
803
|
+
declare module "utility/clear" {
|
|
804
|
+
import type { UserEvent } from "setup/index";
|
|
805
|
+
export function clear(this: UserEvent, element: Element): Promise<void>;
|
|
806
|
+
}
|
|
807
|
+
declare module "utility/selectOptions" {
|
|
808
|
+
import { UserEvent } from "setup/index";
|
|
809
|
+
export function selectOptions(this: UserEvent, select: Element, values: HTMLElement | HTMLElement[] | string[] | string): Promise<void>;
|
|
810
|
+
export function deselectOptions(this: UserEvent, select: Element, values: HTMLElement | HTMLElement[] | string[] | string): Promise<void>;
|
|
811
|
+
}
|
|
812
|
+
declare module "keyboard/keyMap" {
|
|
813
|
+
import { keyboardKey } from "keyboard/types";
|
|
814
|
+
/**
|
|
815
|
+
* Mapping for a default US-104-QWERTY keyboard
|
|
816
|
+
*/
|
|
817
|
+
export const defaultKeyMap: keyboardKey[];
|
|
818
|
+
}
|
|
819
|
+
declare module "pointer/keyMap" {
|
|
820
|
+
import { pointerKey } from "pointer/types";
|
|
821
|
+
export const defaultKeyMap: pointerKey[];
|
|
822
|
+
}
|
|
823
|
+
declare module "options" {
|
|
824
|
+
import type { keyboardKey } from "keyboard/types";
|
|
825
|
+
import type { pointerKey } from "pointer/types";
|
|
826
|
+
export interface Options {
|
|
827
|
+
/**
|
|
828
|
+
* When using `userEvent.upload`, automatically discard files
|
|
829
|
+
* that don't match an `accept` property if it exists.
|
|
830
|
+
*
|
|
831
|
+
* @default true
|
|
832
|
+
*/
|
|
833
|
+
applyAccept?: boolean;
|
|
834
|
+
/**
|
|
835
|
+
* We intend to automatically apply modifier keys for printable characters in the future.
|
|
836
|
+
* I.e. `A` implying `{Shift>}a{/Shift}` if caps lock is not active.
|
|
837
|
+
*
|
|
838
|
+
* This options allows you to opt out of this change in foresight.
|
|
839
|
+
* The feature therefore will not constitute a breaking change.
|
|
840
|
+
*
|
|
841
|
+
* @default true
|
|
842
|
+
*/
|
|
843
|
+
autoModify?: boolean;
|
|
844
|
+
/**
|
|
845
|
+
* Between some subsequent inputs like typing a series of characters
|
|
846
|
+
* the code execution is delayed per `setTimeout` for (at least) `delay` seconds.
|
|
847
|
+
* This moves the next changes at least to next macro task
|
|
848
|
+
* and allows other (asynchronous) code to run between events.
|
|
849
|
+
*
|
|
850
|
+
* `null` prevents `setTimeout` from being called.
|
|
851
|
+
*
|
|
852
|
+
* @default 0
|
|
853
|
+
*/
|
|
854
|
+
delay?: number | null;
|
|
855
|
+
/**
|
|
856
|
+
* The document.
|
|
857
|
+
*
|
|
858
|
+
* This defaults to the owner document of an element if an API is called directly with an element and without setup.
|
|
859
|
+
* Otherwise it falls back to the global document.
|
|
860
|
+
*
|
|
861
|
+
* @default element.ownerDocument??global.document
|
|
862
|
+
*/
|
|
863
|
+
document?: Document;
|
|
864
|
+
/**
|
|
865
|
+
* An array of keyboard keys the keyboard device consists of.
|
|
866
|
+
*
|
|
867
|
+
* This allows to plug in different layouts / localizations.
|
|
868
|
+
*
|
|
869
|
+
* Defaults to a "standard" US-104-QWERTY keyboard.
|
|
870
|
+
*/
|
|
871
|
+
keyboardMap?: keyboardKey[];
|
|
872
|
+
/**
|
|
873
|
+
* An array of available pointer keys.
|
|
874
|
+
*
|
|
875
|
+
* This allows to plug in different pointer devices.
|
|
876
|
+
*/
|
|
877
|
+
pointerMap?: pointerKey[];
|
|
878
|
+
/**
|
|
879
|
+
* `userEvent.type` automatically releases any keys still pressed at the end of the call.
|
|
880
|
+
* This option allows to opt out of this feature.
|
|
881
|
+
*
|
|
882
|
+
* @default false
|
|
883
|
+
*/
|
|
884
|
+
skipAutoClose?: boolean;
|
|
885
|
+
/**
|
|
886
|
+
* `userEvent.type` implys a click at the end of the element content/value.
|
|
887
|
+
* This option allows to opt out of this feature.
|
|
888
|
+
*
|
|
889
|
+
* @default false
|
|
890
|
+
*/
|
|
891
|
+
skipClick?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* `userEvent.click` implys moving the cursor to the target element first.
|
|
894
|
+
* This options allows to opt out of this feature.
|
|
895
|
+
*
|
|
896
|
+
* @default false
|
|
897
|
+
*/
|
|
898
|
+
skipHover?: boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Calling pointer related APIs on an element triggers a check if that element can receive pointer events.
|
|
901
|
+
* This check is known to be expensive.
|
|
902
|
+
* This option allows to skip the check.
|
|
903
|
+
*
|
|
904
|
+
* @default false
|
|
905
|
+
*/
|
|
906
|
+
skipPointerEventsCheck?: boolean;
|
|
907
|
+
/**
|
|
908
|
+
* Write selected data to Clipboard API when a `cut` or `copy` is triggered.
|
|
909
|
+
*
|
|
910
|
+
* The Clipboard API is usually not available to test code.
|
|
911
|
+
* Our `setup` replaces the `navigator.clipboard` property with a stub.
|
|
912
|
+
*
|
|
913
|
+
* Defaults to `false` when calling the APIs directly.
|
|
914
|
+
* Defaults to `true` when calling the APIs per `setup`.
|
|
915
|
+
*/
|
|
916
|
+
writeToClipboard?: boolean;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Default options applied when API is called per `userEvent.anyApi()`
|
|
920
|
+
*/
|
|
921
|
+
export const defaultOptionsDirect: Required<Options>;
|
|
922
|
+
/**
|
|
923
|
+
* Default options applied when API is called per `userEvent().anyApi()`
|
|
924
|
+
*/
|
|
925
|
+
export const defaultOptionsSetup: Required<Options>;
|
|
926
|
+
}
|
|
927
|
+
declare module "setup/config" {
|
|
928
|
+
import type { keyboardState } from "keyboard/types";
|
|
929
|
+
import type { pointerState } from "pointer/types";
|
|
930
|
+
import type { Options } from "options";
|
|
931
|
+
export interface inputDeviceState {
|
|
932
|
+
pointerState: pointerState;
|
|
933
|
+
keyboardState: keyboardState;
|
|
934
|
+
}
|
|
935
|
+
export interface Config extends Required<Options>, inputDeviceState {
|
|
936
|
+
}
|
|
937
|
+
export const Config: unique symbol;
|
|
938
|
+
}
|
|
939
|
+
declare module "utility/type" {
|
|
940
|
+
import type { UserEvent } from "setup/index";
|
|
941
|
+
import { Config } from "setup/config";
|
|
942
|
+
export interface typeOptions {
|
|
943
|
+
skipClick?: Config['skipClick'];
|
|
944
|
+
skipAutoClose?: Config['skipClick'];
|
|
945
|
+
initialSelectionStart?: number;
|
|
946
|
+
initialSelectionEnd?: number;
|
|
947
|
+
}
|
|
948
|
+
export function type(this: UserEvent, element: Element, text: string, { skipClick, skipAutoClose, initialSelectionStart, initialSelectionEnd, }?: typeOptions): Promise<void>;
|
|
949
|
+
}
|
|
950
|
+
declare module "utility/upload" {
|
|
951
|
+
import { UserEvent } from "setup/index";
|
|
952
|
+
export interface uploadInit {
|
|
953
|
+
changeInit?: EventInit;
|
|
954
|
+
}
|
|
955
|
+
export function upload(this: UserEvent, element: HTMLElement, fileOrFiles: File | File[]): Promise<void>;
|
|
956
|
+
}
|
|
957
|
+
declare module "utility/index" {
|
|
958
|
+
export * from "utility/clear";
|
|
959
|
+
export * from "utility/selectOptions";
|
|
960
|
+
export * from "utility/type";
|
|
961
|
+
export * from "utility/upload";
|
|
962
|
+
}
|
|
963
|
+
declare module "setup/api" {
|
|
964
|
+
export { click, dblClick, tripleClick, hover, unhover, tab } from "convenience/index";
|
|
965
|
+
export { keyboard } from "keyboard/index";
|
|
966
|
+
export { copy, cut, paste } from "clipboard/index";
|
|
967
|
+
export { pointer } from "pointer/index";
|
|
968
|
+
export { clear, deselectOptions, selectOptions, type, upload } from "utility/index";
|
|
969
|
+
}
|
|
970
|
+
declare module "setup/wrapAsync" {
|
|
971
|
+
/**
|
|
972
|
+
* Wrap an internal Promise
|
|
973
|
+
*/
|
|
974
|
+
export function wrapAsync<R, P extends (() => Promise<R>) | (() => R)>(implementation: P): Promise<R>;
|
|
975
|
+
}
|
|
976
|
+
declare module "setup/setup" {
|
|
977
|
+
import { Options } from "options";
|
|
978
|
+
import type { UserEvent } from "setup/index";
|
|
979
|
+
import { Config } from "setup/config";
|
|
980
|
+
import * as userEventApi from "setup/api";
|
|
981
|
+
/**
|
|
982
|
+
* Start a "session" with userEvent.
|
|
983
|
+
* All APIs returned by this function share an input device state and a default configuration.
|
|
984
|
+
*/
|
|
985
|
+
export function setupMain(options?: Options): {
|
|
986
|
+
setup: typeof setupSub;
|
|
987
|
+
[Config]: Config;
|
|
988
|
+
click: typeof userEventApi.click;
|
|
989
|
+
dblClick: typeof userEventApi.dblClick;
|
|
990
|
+
tripleClick: typeof userEventApi.tripleClick;
|
|
991
|
+
hover: typeof userEventApi.hover;
|
|
992
|
+
unhover: typeof userEventApi.unhover;
|
|
993
|
+
tab: typeof userEventApi.tab;
|
|
994
|
+
keyboard: typeof userEventApi.keyboard;
|
|
995
|
+
copy: typeof userEventApi.copy;
|
|
996
|
+
cut: typeof userEventApi.cut;
|
|
997
|
+
paste: typeof userEventApi.paste;
|
|
998
|
+
pointer: typeof userEventApi.pointer;
|
|
999
|
+
clear: typeof userEventApi.clear;
|
|
1000
|
+
deselectOptions: typeof userEventApi.deselectOptions;
|
|
1001
|
+
selectOptions: typeof userEventApi.selectOptions;
|
|
1002
|
+
type: typeof userEventApi.type;
|
|
1003
|
+
upload: typeof userEventApi.upload;
|
|
1004
|
+
};
|
|
1005
|
+
/**
|
|
1006
|
+
* Setup in direct call per `userEvent.anyApi()`
|
|
1007
|
+
*/
|
|
1008
|
+
export function setupDirect(options?: Partial<Config>, node?: Node): {
|
|
1009
|
+
setup: typeof setupSub;
|
|
1010
|
+
[Config]: Config;
|
|
1011
|
+
click: typeof userEventApi.click;
|
|
1012
|
+
dblClick: typeof userEventApi.dblClick;
|
|
1013
|
+
tripleClick: typeof userEventApi.tripleClick;
|
|
1014
|
+
hover: typeof userEventApi.hover;
|
|
1015
|
+
unhover: typeof userEventApi.unhover;
|
|
1016
|
+
tab: typeof userEventApi.tab;
|
|
1017
|
+
keyboard: typeof userEventApi.keyboard;
|
|
1018
|
+
copy: typeof userEventApi.copy;
|
|
1019
|
+
cut: typeof userEventApi.cut;
|
|
1020
|
+
paste: typeof userEventApi.paste;
|
|
1021
|
+
pointer: typeof userEventApi.pointer;
|
|
1022
|
+
clear: typeof userEventApi.clear;
|
|
1023
|
+
deselectOptions: typeof userEventApi.deselectOptions;
|
|
1024
|
+
selectOptions: typeof userEventApi.selectOptions;
|
|
1025
|
+
type: typeof userEventApi.type;
|
|
1026
|
+
upload: typeof userEventApi.upload;
|
|
1027
|
+
};
|
|
1028
|
+
/**
|
|
1029
|
+
* Create a set of callbacks with different default settings but the same state.
|
|
1030
|
+
*/
|
|
1031
|
+
export function setupSub(this: UserEvent, options: Options): {
|
|
1032
|
+
setup: typeof setupSub;
|
|
1033
|
+
[Config]: Config;
|
|
1034
|
+
click: typeof userEventApi.click;
|
|
1035
|
+
dblClick: typeof userEventApi.dblClick;
|
|
1036
|
+
tripleClick: typeof userEventApi.tripleClick;
|
|
1037
|
+
hover: typeof userEventApi.hover;
|
|
1038
|
+
unhover: typeof userEventApi.unhover;
|
|
1039
|
+
tab: typeof userEventApi.tab;
|
|
1040
|
+
keyboard: typeof userEventApi.keyboard;
|
|
1041
|
+
copy: typeof userEventApi.copy;
|
|
1042
|
+
cut: typeof userEventApi.cut;
|
|
1043
|
+
paste: typeof userEventApi.paste;
|
|
1044
|
+
pointer: typeof userEventApi.pointer;
|
|
1045
|
+
clear: typeof userEventApi.clear;
|
|
1046
|
+
deselectOptions: typeof userEventApi.deselectOptions;
|
|
1047
|
+
selectOptions: typeof userEventApi.selectOptions;
|
|
1048
|
+
type: typeof userEventApi.type;
|
|
1049
|
+
upload: typeof userEventApi.upload;
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
declare module "setup/directApi" {
|
|
1053
|
+
import type { PointerOptions } from "utils/index";
|
|
1054
|
+
import type { PointerInput } from "pointer/index";
|
|
1055
|
+
import type { UserEventApi } from "setup/index";
|
|
1056
|
+
import { Config } from "setup/config";
|
|
1057
|
+
export function clear(element: Element): Promise<void>;
|
|
1058
|
+
export function click(element: Element, options?: Partial<Config>): Promise<void>;
|
|
1059
|
+
export function copy(options?: Partial<Config>): Promise<DataTransfer | undefined>;
|
|
1060
|
+
export function cut(options?: Partial<Config>): Promise<DataTransfer | undefined>;
|
|
1061
|
+
export function dblClick(element: Element, options?: Partial<Config>): Promise<void>;
|
|
1062
|
+
export function deselectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: Partial<Config>): Promise<void>;
|
|
1063
|
+
export function hover(element: Element, options?: Partial<Config>): Promise<void>;
|
|
1064
|
+
export function keyboard(text: string, options?: Partial<Config>): Promise<import("keyboard").keyboardState>;
|
|
1065
|
+
export function pointer(input: PointerInput, options?: Partial<Config>): Promise<import("pointer").pointerState>;
|
|
1066
|
+
export function paste(clipboardData?: DataTransfer | string, options?: Partial<Config>): Promise<void>;
|
|
1067
|
+
export function selectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: Partial<Config>): Promise<void>;
|
|
1068
|
+
export function tripleClick(element: Element, options?: Partial<Config>): Promise<void>;
|
|
1069
|
+
export function type(element: Element, text: string, options?: Partial<Config> & Parameters<UserEventApi['type']>[2]): Promise<void>;
|
|
1070
|
+
export function unhover(element: Element, options?: PointerOptions): Promise<void>;
|
|
1071
|
+
export function upload(element: HTMLElement, fileOrFiles: File | File[], options?: Partial<Config>): Promise<void>;
|
|
1072
|
+
export function tab(options?: Partial<Config> & Parameters<UserEventApi['tab']>[0]): Promise<void>;
|
|
1073
|
+
}
|
|
1074
|
+
declare module "setup/index" {
|
|
1075
|
+
import type * as userEventApi from "setup/api";
|
|
1076
|
+
import { setupMain, setupSub } from "setup/setup";
|
|
1077
|
+
import { Config, inputDeviceState } from "setup/config";
|
|
1078
|
+
import * as directApi from "setup/directApi";
|
|
1079
|
+
export type { inputDeviceState };
|
|
1080
|
+
export { Config };
|
|
1081
|
+
export type UserEventApi = typeof userEventApi;
|
|
1082
|
+
export type UserEvent = UserEventApi & {
|
|
1083
|
+
readonly setup: typeof setupSub;
|
|
1084
|
+
[Config]: Config;
|
|
1085
|
+
};
|
|
1086
|
+
export const userEvent: {
|
|
1087
|
+
readonly setup: typeof setupMain;
|
|
1088
|
+
readonly clear: typeof directApi.clear;
|
|
1089
|
+
readonly click: typeof directApi.click;
|
|
1090
|
+
readonly copy: typeof directApi.copy;
|
|
1091
|
+
readonly cut: typeof directApi.cut;
|
|
1092
|
+
readonly dblClick: typeof directApi.dblClick;
|
|
1093
|
+
readonly deselectOptions: typeof directApi.deselectOptions;
|
|
1094
|
+
readonly hover: typeof directApi.hover;
|
|
1095
|
+
readonly keyboard: typeof directApi.keyboard;
|
|
1096
|
+
readonly pointer: typeof directApi.pointer;
|
|
1097
|
+
readonly paste: typeof directApi.paste;
|
|
1098
|
+
readonly selectOptions: typeof directApi.selectOptions;
|
|
1099
|
+
readonly tripleClick: typeof directApi.tripleClick;
|
|
1100
|
+
readonly type: typeof directApi.type;
|
|
1101
|
+
readonly unhover: typeof directApi.unhover;
|
|
1102
|
+
readonly upload: typeof directApi.upload;
|
|
1103
|
+
readonly tab: typeof directApi.tab;
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
declare module "index" {
|
|
1107
|
+
export { userEvent as default } from "setup/index";
|
|
1108
|
+
export type { keyboardKey } from "keyboard/index";
|
|
1109
|
+
export type { pointerKey } from "pointer/index";
|
|
1110
|
+
}
|