@testing-library/user-event 14.0.0-beta.4 → 14.0.0-beta.8
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 +5 -192
- package/dist/index.cjs +2943 -0
- package/dist/{index.js → index.mjs} +397 -214
- package/dist/types/clipboard/copy.d.ts +2 -0
- package/dist/types/clipboard/cut.d.ts +2 -0
- package/dist/types/clipboard/index.d.ts +3 -0
- package/dist/types/clipboard/paste.d.ts +2 -0
- package/dist/types/convenience/click.d.ts +4 -0
- package/dist/types/convenience/hover.d.ts +3 -0
- package/dist/types/convenience/index.d.ts +3 -0
- package/dist/types/convenience/tab.d.ts +4 -0
- package/dist/types/document/index.d.ts +10 -0
- package/dist/types/document/interceptor.d.ts +15 -0
- package/dist/types/document/selection.d.ts +27 -0
- package/dist/types/document/value.d.ts +18 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/keyboard/index.d.ts +7 -0
- package/dist/types/keyboard/keyMap.d.ts +5 -0
- package/dist/types/keyboard/keyboardAction.d.ts +10 -0
- package/dist/types/keyboard/parseKeyDef.d.ts +17 -0
- package/dist/types/keyboard/plugins/arrow.d.ts +6 -0
- package/dist/types/keyboard/plugins/character.d.ts +5 -0
- package/dist/types/keyboard/plugins/combination.d.ts +5 -0
- package/dist/types/keyboard/plugins/control.d.ts +6 -0
- package/dist/types/keyboard/plugins/functional.d.ts +8 -0
- package/dist/types/keyboard/plugins/index.d.ts +7 -0
- package/dist/types/keyboard/plugins/modifiers.d.ts +8 -0
- package/dist/types/keyboard/shared/fireChangeForInputTimeIfValid.d.ts +3 -0
- package/dist/types/keyboard/shared/index.d.ts +1 -0
- package/dist/types/keyboard/types.d.ts +78 -0
- package/dist/types/options.d.ts +117 -0
- package/dist/types/pointer/index.d.ts +10 -0
- package/dist/types/pointer/keyMap.d.ts +2 -0
- package/dist/types/pointer/parseKeyDef.d.ts +6 -0
- package/dist/types/pointer/pointerAction.d.ts +7 -0
- package/dist/types/pointer/pointerMove.d.ts +6 -0
- package/dist/types/pointer/pointerPress.d.ts +8 -0
- package/dist/types/pointer/resolveSelectionTarget.d.ts +5 -0
- package/dist/types/pointer/types.d.ts +61 -0
- package/dist/types/setup/api.d.ts +5 -0
- package/dist/types/setup/config.d.ts +10 -0
- package/dist/types/setup/directApi.d.ts +19 -0
- package/dist/types/setup/index.d.ts +34 -0
- package/dist/types/setup/setup.d.ts +19 -0
- package/dist/types/setup/wrapAsync.d.ts +4 -0
- package/dist/types/utility/clear.d.ts +2 -0
- package/dist/types/utility/index.d.ts +4 -0
- package/dist/types/utility/selectOptions.d.ts +3 -0
- package/dist/types/utility/type.d.ts +9 -0
- package/dist/types/utility/upload.d.ts +5 -0
- package/dist/types/utils/click/isClickableInput.d.ts +1 -0
- package/dist/types/utils/dataTransfer/Blob.d.ts +1 -0
- package/dist/types/utils/dataTransfer/Clipboard.d.ts +9 -0
- package/dist/types/utils/dataTransfer/DataTransfer.d.ts +2 -0
- package/dist/types/utils/dataTransfer/FileList.d.ts +1 -0
- package/dist/types/utils/edit/buildTimeValue.d.ts +1 -0
- package/dist/types/utils/edit/calculateNewValue.d.ts +14 -0
- package/dist/types/utils/edit/editInputElement.d.ts +16 -0
- package/dist/types/utils/edit/getValue.d.ts +1 -0
- package/dist/types/utils/edit/isContentEditable.d.ts +7 -0
- package/dist/types/utils/edit/isEditable.d.ts +25 -0
- package/dist/types/utils/edit/isValidDateValue.d.ts +3 -0
- package/dist/types/utils/edit/isValidInputTimeValue.d.ts +3 -0
- package/dist/types/utils/edit/maxLength.d.ts +1 -0
- package/dist/types/utils/edit/prepareInput.d.ts +7 -0
- package/dist/types/utils/edit/setFiles.d.ts +12 -0
- package/dist/types/utils/focus/blur.d.ts +2 -0
- package/dist/types/utils/focus/copySelection.d.ts +1 -0
- package/dist/types/utils/focus/cursor.d.ts +9 -0
- package/dist/types/utils/focus/focus.d.ts +5 -0
- package/dist/types/utils/focus/getActiveElement.d.ts +1 -0
- package/dist/types/utils/focus/getTabDestination.d.ts +1 -0
- package/dist/types/utils/focus/isFocusable.d.ts +1 -0
- package/dist/types/utils/focus/selectAll.d.ts +5 -0
- package/dist/types/utils/focus/selection.d.ts +42 -0
- package/dist/types/utils/focus/selector.d.ts +1 -0
- package/dist/types/utils/index.d.ts +42 -0
- package/dist/types/utils/keyDef/readNextDescriptor.d.ts +19 -0
- package/dist/types/utils/keyboard/getKeyEventProps.d.ts +17 -0
- package/dist/types/utils/keyboard/getUIEventModifiers.d.ts +15 -0
- package/dist/types/utils/misc/eventWrapper.d.ts +1 -0
- package/dist/types/utils/misc/findClosest.d.ts +1 -0
- package/dist/types/utils/misc/getDocumentFromNode.d.ts +1 -0
- package/dist/types/utils/misc/hasFormSubmit.d.ts +1 -0
- package/dist/types/utils/misc/isDescendantOrSelf.d.ts +1 -0
- package/dist/types/utils/misc/isDisabled.d.ts +1 -0
- package/dist/types/utils/misc/isElementType.d.ts +5 -0
- package/dist/types/utils/misc/isVisible.d.ts +1 -0
- package/dist/types/utils/misc/level.d.ts +17 -0
- package/dist/types/utils/misc/wait.d.ts +1 -0
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +15 -0
- package/dist/types/utils/pointer/firePointerEvents.d.ts +25 -0
- package/dist/types/utils/pointer/mouseButtons.d.ts +12 -0
- package/package.json +10 -3
- package/dist/index.d.ts +0 -1110
- package/dist/package.json +0 -1
|
@@ -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 @@
|
|
|
1
|
+
export declare function isClickableInput(element: Element): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readBlobText(blob: Blob): Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function createClipboardItem(...blobs: Array<Blob | string>): ClipboardItem;
|
|
2
|
+
export declare function attachClipboardStubToView(window: Window & typeof globalThis): {
|
|
3
|
+
resetClipboardStub: () => void;
|
|
4
|
+
detachClipboardStub: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function resetClipboardStubOnView(window: Window & typeof globalThis): void;
|
|
7
|
+
export declare function detachClipboardStubFromView(window: Window & typeof globalThis): void;
|
|
8
|
+
export declare function readDataTransferFromClipboard(document: Document): Promise<DataTransfer>;
|
|
9
|
+
export declare function writeDataTransferToClipboard(document: Document, clipboardData: DataTransfer): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createFileList(files: File[]): FileList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildTimeValue(value: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditableInputType } from './isEditable';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate a new text value.
|
|
4
|
+
*/
|
|
5
|
+
export declare function calculateNewValue(inputData: string, node: (HTMLInputElement & {
|
|
6
|
+
type: EditableInputType;
|
|
7
|
+
}) | HTMLTextAreaElement, { startOffset, endOffset, }: {
|
|
8
|
+
startOffset: number;
|
|
9
|
+
endOffset: number;
|
|
10
|
+
}, inputType?: string): {
|
|
11
|
+
oldValue: string;
|
|
12
|
+
newValue: string;
|
|
13
|
+
newOffset: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fireEvent } from '@testing-library/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Change the value of an element as if it was changed as a result of a user input.
|
|
4
|
+
*
|
|
5
|
+
* Fires the input event.
|
|
6
|
+
*/
|
|
7
|
+
export declare function editInputElement(element: HTMLInputElement | HTMLTextAreaElement, { newValue, newSelection, eventOverrides, }: {
|
|
8
|
+
newValue: string;
|
|
9
|
+
newSelection: {
|
|
10
|
+
node: Node;
|
|
11
|
+
offset: number;
|
|
12
|
+
};
|
|
13
|
+
eventOverrides: Partial<Parameters<typeof fireEvent>[1]> & {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getValue<T extends Element | null>(element: T): T extends HTMLInputElement | HTMLTextAreaElement ? string : string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function isContentEditable(element: Element): element is HTMLElement & {
|
|
2
|
+
contenteditable: 'true';
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* If a node is a contenteditable or inside one, return that element.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getContentEditable(node: Node): Element | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isContentEditable } from './isContentEditable';
|
|
2
|
+
declare type GuardedType<T> = T extends (x: any) => x is infer R ? R : never;
|
|
3
|
+
export declare function isEditable(element: Element): element is GuardedType<typeof isContentEditable> | GuardedType<typeof isEditableInput> | (HTMLTextAreaElement & {
|
|
4
|
+
readOnly: false;
|
|
5
|
+
});
|
|
6
|
+
export declare enum editableInputTypes {
|
|
7
|
+
'text' = "text",
|
|
8
|
+
'date' = "date",
|
|
9
|
+
'datetime-local' = "datetime-local",
|
|
10
|
+
'email' = "email",
|
|
11
|
+
'month' = "month",
|
|
12
|
+
'number' = "number",
|
|
13
|
+
'password' = "password",
|
|
14
|
+
'search' = "search",
|
|
15
|
+
'tel' = "tel",
|
|
16
|
+
'time' = "time",
|
|
17
|
+
'url' = "url",
|
|
18
|
+
'week' = "week"
|
|
19
|
+
}
|
|
20
|
+
export declare type EditableInputType = keyof typeof editableInputTypes;
|
|
21
|
+
export declare function isEditableInput(element: Element): element is HTMLInputElement & {
|
|
22
|
+
readOnly: false;
|
|
23
|
+
type: editableInputTypes;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSpaceUntilMaxLength(element: Element): number | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const fakeFiles: unique symbol;
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLInputElement {
|
|
4
|
+
[fakeFiles]?: {
|
|
5
|
+
restore: () => void;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare function setFiles(el: HTMLInputElement & {
|
|
10
|
+
type: 'file';
|
|
11
|
+
}, files: FileList): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function copySelection(target: Element): DataTransfer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getActiveElement(document: Document | ShadowRoot): Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTabDestination(activeElement: Element, shift: boolean): HTMLElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isFocusable(element: Element): element is HTMLElement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { UISelectionRange } from '../../document';
|
|
2
|
+
import { editableInputTypes } from '../edit/isEditable';
|
|
3
|
+
/**
|
|
4
|
+
* Backward-compatible selection.
|
|
5
|
+
*
|
|
6
|
+
* Handles input elements and contenteditable if it only contains a single text node.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setSelectionRange(element: Element, anchorOffset: number, focusOffset: number): void;
|
|
9
|
+
/**
|
|
10
|
+
* Determine if the element has its own selection implementation
|
|
11
|
+
* and does not interact with the Document Selection API.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasOwnSelection(node: Node): node is HTMLTextAreaElement | (HTMLInputElement & {
|
|
14
|
+
type: editableInputTypes;
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Reset the Document Selection when moving focus into an element
|
|
18
|
+
* with own selection implementation.
|
|
19
|
+
*/
|
|
20
|
+
export declare function updateSelectionOnFocus(element: Element): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get the range that would be overwritten by input.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getInputRange(focusNode: Node): UISelectionRange | Range | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
|
|
27
|
+
*/
|
|
28
|
+
export declare function modifySelection({ focusNode, focusOffset, }: {
|
|
29
|
+
focusNode: Node;
|
|
30
|
+
/** DOM Offset */
|
|
31
|
+
focusOffset: number;
|
|
32
|
+
}): void;
|
|
33
|
+
/**
|
|
34
|
+
* Set the selection
|
|
35
|
+
*/
|
|
36
|
+
export declare function setSelection({ focusNode, focusOffset, anchorNode, anchorOffset, }: {
|
|
37
|
+
anchorNode?: Node;
|
|
38
|
+
/** DOM offset */
|
|
39
|
+
anchorOffset?: number;
|
|
40
|
+
focusNode: Node;
|
|
41
|
+
focusOffset: number;
|
|
42
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FOCUSABLE_SELECTOR: string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export * from './click/isClickableInput';
|
|
2
|
+
export * from './dataTransfer/Blob';
|
|
3
|
+
export * from './dataTransfer/DataTransfer';
|
|
4
|
+
export * from './dataTransfer/FileList';
|
|
5
|
+
export * from './dataTransfer/Clipboard';
|
|
6
|
+
export * from './edit/buildTimeValue';
|
|
7
|
+
export * from './edit/calculateNewValue';
|
|
8
|
+
export * from './edit/editInputElement';
|
|
9
|
+
export * from './edit/getValue';
|
|
10
|
+
export * from './edit/isContentEditable';
|
|
11
|
+
export * from './edit/isEditable';
|
|
12
|
+
export * from './edit/isValidDateValue';
|
|
13
|
+
export * from './edit/isValidInputTimeValue';
|
|
14
|
+
export * from './edit/maxLength';
|
|
15
|
+
export * from './edit/prepareInput';
|
|
16
|
+
export * from './edit/setFiles';
|
|
17
|
+
export * from './focus/blur';
|
|
18
|
+
export * from './focus/copySelection';
|
|
19
|
+
export * from './focus/cursor';
|
|
20
|
+
export * from './focus/focus';
|
|
21
|
+
export * from './focus/getActiveElement';
|
|
22
|
+
export * from './focus/getTabDestination';
|
|
23
|
+
export * from './focus/isFocusable';
|
|
24
|
+
export * from './focus/selectAll';
|
|
25
|
+
export * from './focus/selection';
|
|
26
|
+
export * from './focus/selector';
|
|
27
|
+
export * from './keyboard/getKeyEventProps';
|
|
28
|
+
export * from './keyboard/getUIEventModifiers';
|
|
29
|
+
export * from './keyDef/readNextDescriptor';
|
|
30
|
+
export * from './misc/eventWrapper';
|
|
31
|
+
export * from './misc/findClosest';
|
|
32
|
+
export * from './misc/getDocumentFromNode';
|
|
33
|
+
export * from './misc/isDescendantOrSelf';
|
|
34
|
+
export * from './misc/isElementType';
|
|
35
|
+
export * from './misc/isVisible';
|
|
36
|
+
export * from './misc/isDisabled';
|
|
37
|
+
export * from './misc/level';
|
|
38
|
+
export * from './misc/wait';
|
|
39
|
+
export * from './misc/hasFormSubmit';
|
|
40
|
+
export * from './pointer/cssPointerEvents';
|
|
41
|
+
export * from './pointer/firePointerEvents';
|
|
42
|
+
export * from './pointer/mouseButtons';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the next key definition from user input
|
|
3
|
+
*
|
|
4
|
+
* Describe key per `{descriptor}` or `[descriptor]`.
|
|
5
|
+
* Everything else will be interpreted as a single character as descriptor - e.g. `a`.
|
|
6
|
+
* Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
|
|
7
|
+
* A previously pressed key can be released per `{/descriptor}`.
|
|
8
|
+
* Keeping the key pressed can be written as `{descriptor>}`.
|
|
9
|
+
* When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
|
|
10
|
+
* You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readNextDescriptor(text: string): {
|
|
13
|
+
consumedLength: number;
|
|
14
|
+
descriptor: string;
|
|
15
|
+
releasePrevious: boolean;
|
|
16
|
+
repeat: number;
|
|
17
|
+
releaseSelf: boolean | undefined;
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function eventWrapper<T>(cb: () => T): T | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findClosest<T extends Element>(element: Element, callback: (e: Element) => e is T): T | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDocumentFromNode(el: Node): Document | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hasFormSubmit: (form: HTMLFormElement | null) => form is HTMLFormElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isDescendantOrSelf(potentialDescendant: Element, potentialAncestor: Element): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isDisabled(element: Element | null): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare type tag = keyof HTMLElementTagNameMap;
|
|
2
|
+
export declare function isElementType<T extends tag, P extends {
|
|
3
|
+
[k: string]: unknown;
|
|
4
|
+
} | undefined = undefined>(element: Element, tag: T | T[], props?: P): element is P extends undefined ? HTMLElementTagNameMap[T] : HTMLElementTagNameMap[T] & P;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isVisible(element: Element): boolean;
|
|
@@ -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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function wait(time?: number): Promise<void>;
|
|
@@ -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 {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { pointerState } from '../../pointer/types';
|
|
2
|
+
import type { keyboardState } from '../../keyboard/types';
|
|
3
|
+
import { MouseButton } from './mouseButtons';
|
|
4
|
+
export declare function firePointerEvent(target: Element, type: string, { pointerState, keyboardState, pointerType, button, coords, pointerId, isPrimary, clickCount, }: {
|
|
5
|
+
pointerState: pointerState;
|
|
6
|
+
keyboardState: keyboardState;
|
|
7
|
+
pointerType?: 'mouse' | 'pen' | 'touch';
|
|
8
|
+
button?: MouseButton;
|
|
9
|
+
coords?: PointerCoords;
|
|
10
|
+
pointerId?: number;
|
|
11
|
+
isPrimary?: boolean;
|
|
12
|
+
clickCount?: number;
|
|
13
|
+
}): boolean;
|
|
14
|
+
export interface PointerCoords {
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
clientX?: number;
|
|
18
|
+
clientY?: number;
|
|
19
|
+
offsetX?: number;
|
|
20
|
+
offsetY?: number;
|
|
21
|
+
pageX?: number;
|
|
22
|
+
pageY?: number;
|
|
23
|
+
screenX?: number;
|
|
24
|
+
screenY?: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const MouseButton: {
|
|
2
|
+
readonly primary: 0;
|
|
3
|
+
readonly secondary: 1;
|
|
4
|
+
readonly auxiliary: 2;
|
|
5
|
+
readonly back: 3;
|
|
6
|
+
readonly X1: 3;
|
|
7
|
+
readonly forward: 4;
|
|
8
|
+
readonly X2: 4;
|
|
9
|
+
};
|
|
10
|
+
export declare type MouseButton = keyof typeof MouseButton | number;
|
|
11
|
+
export declare function getMouseButton(button: MouseButton): number;
|
|
12
|
+
export declare function getMouseButtons(...buttons: Array<MouseButton>): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/user-event",
|
|
3
|
-
"version": "14.0.0-beta.
|
|
3
|
+
"version": "14.0.0-beta.8",
|
|
4
4
|
"description": "Fire events the same way the user does",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-testing-library",
|
|
@@ -25,8 +25,15 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
|
-
"main": "./dist/index.
|
|
29
|
-
"
|
|
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",
|
|
30
37
|
"scripts": {
|
|
31
38
|
"build": "node build.js",
|
|
32
39
|
"lint": "kcd-scripts lint",
|