@testing-library/user-event 14.0.0-beta.1 → 14.0.0-beta.12
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 +2878 -0
- package/dist/index.mjs +2949 -0
- package/dist/types/clipboard/copy.d.ts +2 -0
- package/dist/types/clipboard/cut.d.ts +2 -0
- package/dist/{clipboard → types/clipboard}/index.d.ts +0 -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/{convenience → types/convenience}/index.d.ts +0 -0
- package/dist/types/convenience/tab.d.ts +4 -0
- package/dist/{document → types/document}/index.d.ts +0 -0
- package/dist/{document → types/document}/interceptor.d.ts +0 -0
- package/dist/{document → types/document}/selection.d.ts +0 -0
- package/dist/{document → types/document}/value.d.ts +0 -0
- package/dist/types/event/behavior/click.d.ts +1 -0
- package/dist/types/event/behavior/cut.d.ts +1 -0
- package/dist/types/event/behavior/index.d.ts +8 -0
- package/dist/types/event/behavior/keydown.d.ts +1 -0
- package/dist/types/event/behavior/keypress.d.ts +1 -0
- package/dist/types/event/behavior/keyup.d.ts +1 -0
- package/dist/types/event/behavior/paste.d.ts +1 -0
- package/dist/types/event/behavior/registry.d.ts +9 -0
- package/dist/types/event/createEvent.d.ts +8 -0
- package/dist/types/event/dispatchEvent.d.ts +2 -0
- package/dist/types/event/eventMap.d.ts +345 -0
- package/dist/types/event/eventTypes.d.ts +2 -0
- package/dist/types/event/index.d.ts +6 -0
- package/dist/types/event/types.d.ts +13 -0
- package/dist/types/event/wrapEvent.d.ts +1 -0
- package/dist/{index.d.ts → types/index.d.ts} +1 -0
- package/dist/{keyboard → types/keyboard}/index.d.ts +2 -2
- package/dist/{keyboard → types/keyboard}/keyMap.d.ts +0 -0
- package/dist/{keyboard → types/keyboard}/keyboardAction.d.ts +0 -0
- package/dist/types/keyboard/modifiers.d.ts +9 -0
- package/dist/{keyboard → types/keyboard}/parseKeyDef.d.ts +0 -0
- package/dist/{keyboard → types/keyboard}/types.d.ts +19 -10
- package/dist/{options.d.ts → types/options.d.ts} +23 -8
- package/dist/types/pointer/firePointerEvents.d.ts +11 -0
- package/dist/{pointer → types/pointer}/index.d.ts +2 -2
- package/dist/{pointer → types/pointer}/keyMap.d.ts +0 -0
- package/dist/{pointer → types/pointer}/parseKeyDef.d.ts +0 -0
- package/dist/{pointer → types/pointer}/pointerAction.d.ts +0 -0
- package/dist/types/pointer/pointerMove.d.ts +6 -0
- package/dist/{pointer → types/pointer}/pointerPress.d.ts +2 -2
- package/dist/{pointer → types/pointer}/resolveSelectionTarget.d.ts +0 -0
- package/dist/{pointer → types/pointer}/types.d.ts +2 -1
- package/dist/{setup → types/setup}/api.d.ts +0 -0
- package/dist/{setup → types/setup}/config.d.ts +0 -0
- package/dist/{setup → types/setup}/directApi.d.ts +1 -2
- package/dist/{setup → types/setup}/index.d.ts +8 -2
- package/dist/types/setup/setup.d.ts +20 -0
- package/dist/{setup → types/setup}/wrapAsync.d.ts +0 -0
- package/dist/types/utility/clear.d.ts +2 -0
- package/dist/{utility → types/utility}/index.d.ts +0 -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/{utils → types/utils}/click/isClickableInput.d.ts +0 -0
- package/dist/{utils → types/utils}/dataTransfer/Blob.d.ts +0 -0
- package/dist/{utils → types/utils}/dataTransfer/Clipboard.d.ts +0 -0
- package/dist/{utils → types/utils}/dataTransfer/DataTransfer.d.ts +0 -0
- package/dist/{utils → types/utils}/dataTransfer/FileList.d.ts +0 -0
- package/dist/{utils → types/utils}/edit/buildTimeValue.d.ts +0 -0
- package/dist/{utils → types/utils}/edit/getValue.d.ts +0 -0
- package/dist/types/utils/edit/input.d.ts +2 -0
- package/dist/{utils → types/utils}/edit/isContentEditable.d.ts +0 -0
- package/dist/{utils → types/utils}/edit/isEditable.d.ts +0 -0
- package/dist/types/utils/edit/isValidDateOrTimeValue.d.ts +3 -0
- package/dist/{utils → types/utils}/edit/maxLength.d.ts +0 -0
- package/dist/{utils → types/utils}/edit/setFiles.d.ts +0 -0
- package/dist/{utils → types/utils}/focus/blur.d.ts +0 -0
- package/dist/{utils → types/utils}/focus/copySelection.d.ts +0 -0
- package/dist/types/utils/focus/cursor.d.ts +9 -0
- package/dist/{utils → types/utils}/focus/focus.d.ts +3 -0
- package/dist/{utils → types/utils}/focus/getActiveElement.d.ts +0 -0
- package/dist/{utils → types/utils}/focus/getTabDestination.d.ts +0 -0
- package/dist/{utils → types/utils}/focus/isFocusable.d.ts +0 -0
- package/dist/{utils → types/utils}/focus/selectAll.d.ts +0 -0
- package/dist/{utils → types/utils}/focus/selection.d.ts +4 -0
- package/dist/{utils → types/utils}/focus/selector.d.ts +0 -0
- package/dist/{utils → types/utils}/index.d.ts +7 -10
- package/dist/{utils → types/utils}/keyDef/readNextDescriptor.d.ts +0 -0
- package/dist/types/utils/keyboard/getKeyEventProps.d.ts +5 -0
- package/dist/types/utils/keyboard/getUIEventModifiers.d.ts +15 -0
- package/dist/types/utils/misc/cloneEvent.d.ts +1 -0
- package/dist/{utils → types/utils}/misc/eventWrapper.d.ts +0 -0
- package/dist/types/utils/misc/findClosest.d.ts +1 -0
- package/dist/{utils → types/utils}/misc/getDocumentFromNode.d.ts +0 -0
- package/dist/{utils → types/utils}/misc/isDescendantOrSelf.d.ts +0 -0
- package/dist/{utils → types/utils}/misc/isDisabled.d.ts +0 -0
- package/dist/{utils → types/utils}/misc/isElementType.d.ts +0 -0
- package/dist/{utils → types/utils}/misc/isVisible.d.ts +0 -0
- package/dist/types/utils/misc/level.d.ts +17 -0
- package/dist/{utils → types/utils}/misc/wait.d.ts +0 -0
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +15 -0
- package/dist/{utils → types/utils}/pointer/mouseButtons.d.ts +0 -0
- package/package.json +13 -30
- package/CHANGELOG.md +0 -5
- 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.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.js +0 -44
- package/dist/convenience/tab.d.ts +0 -4
- package/dist/convenience/tab.js +0 -12
- package/dist/document/index.js +0 -100
- package/dist/document/interceptor.js +0 -37
- package/dist/document/selection.js +0 -90
- package/dist/document/value.js +0 -77
- package/dist/index.js +0 -13
- package/dist/keyboard/getEventProps.d.ts +0 -15
- package/dist/keyboard/getEventProps.js +0 -27
- package/dist/keyboard/index.js +0 -42
- package/dist/keyboard/keyMap.js +0 -119
- package/dist/keyboard/keyboardAction.js +0 -156
- 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.js +0 -19
- package/dist/options.js +0 -36
- package/dist/pointer/index.js +0 -56
- package/dist/pointer/keyMap.js +0 -29
- package/dist/pointer/parseKeyDef.js +0 -34
- 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.js +0 -330
- package/dist/pointer/resolveSelectionTarget.js +0 -75
- package/dist/pointer/types.js +0 -1
- package/dist/setup/api.js +0 -111
- package/dist/setup/config.js +0 -8
- package/dist/setup/directApi.js +0 -95
- 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.js +0 -15
- package/dist/utility/clear.d.ts +0 -2
- package/dist/utility/clear.js +0 -30
- 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.js +0 -14
- package/dist/utils/dataTransfer/Blob.js +0 -21
- package/dist/utils/dataTransfer/Clipboard.js +0 -188
- package/dist/utils/dataTransfer/DataTransfer.js +0 -158
- package/dist/utils/dataTransfer/FileList.js +0 -23
- 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.js +0 -23
- package/dist/utils/edit/isContentEditable.js +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.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.js +0 -72
- package/dist/utils/focus/blur.js +0 -19
- package/dist/utils/focus/copySelection.js +0 -36
- package/dist/utils/focus/focus.js +0 -22
- package/dist/utils/focus/getActiveElement.js +0 -26
- package/dist/utils/focus/getTabDestination.js +0 -71
- package/dist/utils/focus/isFocusable.js +0 -12
- package/dist/utils/focus/selectAll.js +0 -51
- package/dist/utils/focus/selection.js +0 -190
- package/dist/utils/focus/selector.js +0 -8
- package/dist/utils/index.js +0 -499
- package/dist/utils/keyDef/readNextDescriptor.js +0 -102
- 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.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.js +0 -20
- package/dist/utils/misc/isDisabled.js +0 -12
- package/dist/utils/misc/isElementType.js +0 -24
- package/dist/utils/misc/isVisible.js +0 -24
- package/dist/utils/misc/wait.js +0 -10
- package/dist/utils/pointer/firePointerEvents.d.ts +0 -25
- package/dist/utils/pointer/firePointerEvents.js +0 -112
- package/dist/utils/pointer/mouseButtons.js +0 -45
|
@@ -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?:
|
|
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>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { bindDispatchUIEvent } from '../event';
|
|
1
2
|
import type * as userEventApi from './api';
|
|
2
3
|
import { setupMain, setupSub } from './setup';
|
|
3
4
|
import { Config, inputDeviceState } from './config';
|
|
@@ -5,9 +6,14 @@ import * as directApi from './directApi';
|
|
|
5
6
|
export type { inputDeviceState };
|
|
6
7
|
export { Config };
|
|
7
8
|
export declare type UserEventApi = typeof userEventApi;
|
|
8
|
-
export declare type
|
|
9
|
-
readonly setup: typeof setupSub;
|
|
9
|
+
export declare type Instance = UserEventApi & {
|
|
10
10
|
[Config]: Config;
|
|
11
|
+
dispatchUIEvent: ReturnType<typeof bindDispatchUIEvent>;
|
|
12
|
+
};
|
|
13
|
+
export declare type UserEvent = {
|
|
14
|
+
readonly setup: (...args: Parameters<typeof setupSub>) => UserEvent;
|
|
15
|
+
} & {
|
|
16
|
+
readonly [k in keyof UserEventApi]: (...args: Parameters<UserEventApi[k]>) => ReturnType<UserEventApi[k]>;
|
|
11
17
|
};
|
|
12
18
|
export declare const userEvent: {
|
|
13
19
|
readonly setup: typeof setupMain;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Options } from '../options';
|
|
2
|
+
import type { Instance, UserEvent } from './index';
|
|
3
|
+
import { Config } from './config';
|
|
4
|
+
export declare function createConfig(options?: Partial<Config>, defaults?: Required<Options>, node?: Node): Config;
|
|
5
|
+
/**
|
|
6
|
+
* Start a "session" with userEvent.
|
|
7
|
+
* All APIs returned by this function share an input device state and a default configuration.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setupMain(options?: Options): UserEvent;
|
|
10
|
+
/**
|
|
11
|
+
* Setup in direct call per `userEvent.anyApi()`
|
|
12
|
+
*/
|
|
13
|
+
export declare function setupDirect(options?: Partial<Config>, node?: Node): {
|
|
14
|
+
config: Config;
|
|
15
|
+
api: UserEvent;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Create a set of callbacks with different default settings but the same state.
|
|
19
|
+
*/
|
|
20
|
+
export declare function setupSub(this: Instance, options: Options): UserEvent;
|
|
File without changes
|
|
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>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -3,19 +3,14 @@ export * from './dataTransfer/Blob';
|
|
|
3
3
|
export * from './dataTransfer/DataTransfer';
|
|
4
4
|
export * from './dataTransfer/FileList';
|
|
5
5
|
export * from './dataTransfer/Clipboard';
|
|
6
|
-
export * from './edit/buildTimeValue';
|
|
7
|
-
export * from './edit/calculateNewValue';
|
|
8
|
-
export * from './edit/editInputElement';
|
|
9
6
|
export * from './edit/getValue';
|
|
7
|
+
export * from './edit/input';
|
|
10
8
|
export * from './edit/isContentEditable';
|
|
11
9
|
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
10
|
export * from './edit/setFiles';
|
|
17
11
|
export * from './focus/blur';
|
|
18
12
|
export * from './focus/copySelection';
|
|
13
|
+
export * from './focus/cursor';
|
|
19
14
|
export * from './focus/focus';
|
|
20
15
|
export * from './focus/getActiveElement';
|
|
21
16
|
export * from './focus/getTabDestination';
|
|
@@ -23,7 +18,10 @@ export * from './focus/isFocusable';
|
|
|
23
18
|
export * from './focus/selectAll';
|
|
24
19
|
export * from './focus/selection';
|
|
25
20
|
export * from './focus/selector';
|
|
21
|
+
export * from './keyboard/getKeyEventProps';
|
|
22
|
+
export * from './keyboard/getUIEventModifiers';
|
|
26
23
|
export * from './keyDef/readNextDescriptor';
|
|
24
|
+
export * from './misc/cloneEvent';
|
|
27
25
|
export * from './misc/eventWrapper';
|
|
28
26
|
export * from './misc/findClosest';
|
|
29
27
|
export * from './misc/getDocumentFromNode';
|
|
@@ -31,8 +29,7 @@ export * from './misc/isDescendantOrSelf';
|
|
|
31
29
|
export * from './misc/isElementType';
|
|
32
30
|
export * from './misc/isVisible';
|
|
33
31
|
export * from './misc/isDisabled';
|
|
32
|
+
export * from './misc/level';
|
|
34
33
|
export * from './misc/wait';
|
|
35
|
-
export * from './
|
|
36
|
-
export * from './misc/hasFormSubmit';
|
|
37
|
-
export * from './pointer/firePointerEvents';
|
|
34
|
+
export * from './pointer/cssPointerEvents';
|
|
38
35
|
export * from './pointer/mouseButtons';
|
|
File without changes
|
|
@@ -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 cloneEvent<E extends Event>(event: E): E;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findClosest<T extends Element>(element: Element, callback: (e: Element) => e is T): T | undefined;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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 {};
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/user-event",
|
|
3
|
-
"version": "14.0.0-beta.
|
|
3
|
+
"version": "14.0.0-beta.12",
|
|
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": "
|
|
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
|
}
|
package/CHANGELOG.md
DELETED
package/dist/clipboard/copy.d.ts
DELETED
package/dist/clipboard/copy.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copy = copy;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _setup = require("../setup");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function copy() {
|
|
15
|
-
var _doc$activeElement;
|
|
16
|
-
|
|
17
|
-
const doc = this[_setup.Config].document;
|
|
18
|
-
const target = (_doc$activeElement = doc.activeElement) != null ? _doc$activeElement :
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
doc.body;
|
|
21
|
-
const clipboardData = (0, _utils.copySelection)(target);
|
|
22
|
-
|
|
23
|
-
if (clipboardData.items.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_dom.fireEvent.copy(target, {
|
|
28
|
-
clipboardData
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (this[_setup.Config].writeToClipboard) {
|
|
32
|
-
await (0, _utils.writeDataTransferToClipboard)(doc, clipboardData);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return clipboardData;
|
|
36
|
-
}
|
package/dist/clipboard/cut.d.ts
DELETED
package/dist/clipboard/cut.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cut = cut;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _setup = require("../setup");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function cut() {
|
|
15
|
-
var _doc$activeElement;
|
|
16
|
-
|
|
17
|
-
const doc = this[_setup.Config].document;
|
|
18
|
-
const target = (_doc$activeElement = doc.activeElement) != null ? _doc$activeElement :
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
doc.body;
|
|
21
|
-
const clipboardData = (0, _utils.copySelection)(target);
|
|
22
|
-
|
|
23
|
-
if (clipboardData.items.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_dom.fireEvent.cut(target, {
|
|
28
|
-
clipboardData
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if ((0, _utils.isEditable)(target)) {
|
|
32
|
-
var _prepareInput;
|
|
33
|
-
|
|
34
|
-
(_prepareInput = (0, _utils.prepareInput)('', target, 'deleteByCut')) == null ? void 0 : _prepareInput.commit();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (this[_setup.Config].writeToClipboard) {
|
|
38
|
-
await (0, _utils.writeDataTransferToClipboard)(doc, clipboardData);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return clipboardData;
|
|
42
|
-
}
|
package/dist/clipboard/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _copy = require("./copy");
|
|
8
|
-
|
|
9
|
-
Object.keys(_copy).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _copy[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _copy[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
var _cut = require("./cut");
|
|
21
|
-
|
|
22
|
-
Object.keys(_cut).forEach(function (key) {
|
|
23
|
-
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] === _cut[key]) return;
|
|
25
|
-
Object.defineProperty(exports, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _cut[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _paste = require("./paste");
|
|
34
|
-
|
|
35
|
-
Object.keys(_paste).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (key in exports && exports[key] === _paste[key]) return;
|
|
38
|
-
Object.defineProperty(exports, key, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _paste[key];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
package/dist/clipboard/paste.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.paste = paste;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _setup = require("../setup");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function paste(clipboardData) {
|
|
15
|
-
var _doc$activeElement, _ref;
|
|
16
|
-
|
|
17
|
-
const doc = this[_setup.Config].document;
|
|
18
|
-
const target = (_doc$activeElement = doc.activeElement) != null ? _doc$activeElement :
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
doc.body;
|
|
21
|
-
const data = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(clipboardData) : clipboardData) != null ? _ref : await (0, _utils.readDataTransferFromClipboard)(doc).catch(() => {
|
|
22
|
-
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
|
|
23
|
-
});
|
|
24
|
-
return pasteImpl(target, data);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function pasteImpl(target, clipboardData) {
|
|
28
|
-
_dom.fireEvent.paste(target, {
|
|
29
|
-
clipboardData
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if ((0, _utils.isEditable)(target)) {
|
|
33
|
-
const data = clipboardData.getData('text').substr(0, (0, _utils.getSpaceUntilMaxLength)(target));
|
|
34
|
-
|
|
35
|
-
if (data) {
|
|
36
|
-
var _prepareInput;
|
|
37
|
-
|
|
38
|
-
(_prepareInput = (0, _utils.prepareInput)(data, target, 'insertFromPaste')) == null ? void 0 : _prepareInput.commit();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function getClipboardDataFromString(text) {
|
|
44
|
-
const dt = (0, _utils.createDataTransfer)();
|
|
45
|
-
dt.setData('text', text);
|
|
46
|
-
return dt;
|
|
47
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { UserEvent } from '../setup';
|
|
2
|
-
export declare function click(this: UserEvent, element: Element): Promise<void>;
|
|
3
|
-
export declare function dblClick(this: UserEvent, element: Element): Promise<void>;
|
|
4
|
-
export declare function tripleClick(this: UserEvent, element: Element): Promise<void>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.click = click;
|
|
7
|
-
exports.dblClick = dblClick;
|
|
8
|
-
exports.tripleClick = tripleClick;
|
|
9
|
-
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
|
|
12
|
-
var _setup = require("../setup");
|
|
13
|
-
|
|
14
|
-
async function click(element) {
|
|
15
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
16
|
-
throw new Error('unable to click element as it has or inherits pointer-events set to "none".');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const pointerIn = [];
|
|
20
|
-
|
|
21
|
-
if (!this[_setup.Config].skipHover) {
|
|
22
|
-
pointerIn.push({
|
|
23
|
-
target: element
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
pointerIn.push({
|
|
28
|
-
keys: '[MouseLeft]',
|
|
29
|
-
target: element
|
|
30
|
-
});
|
|
31
|
-
return this.pointer(pointerIn);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function dblClick(element) {
|
|
35
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
36
|
-
throw new Error('unable to double-click element as it has or inherits pointer-events set to "none".');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return this.pointer([{
|
|
40
|
-
target: element
|
|
41
|
-
}, '[MouseLeft][MouseLeft]']);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async function tripleClick(element) {
|
|
45
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
46
|
-
throw new Error('unable to triple-click element as it has or inherits pointer-events set to "none".');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return this.pointer([{
|
|
50
|
-
target: element
|
|
51
|
-
}, '[MouseLeft][MouseLeft][MouseLeft]']);
|
|
52
|
-
}
|