@testing-library/user-event
Advanced tools
Comparing version 14.3.0 to 14.4.0
@@ -1,8 +0,2 @@ | ||
import { EventType } from './types'; | ||
export declare type EventTypeInit<K extends EventType> = SpecificEventInit<FixedDocumentEventMap[K]>; | ||
interface FixedDocumentEventMap extends DocumentEventMap { | ||
input: InputEvent; | ||
} | ||
declare type SpecificEventInit<E extends Event> = E extends InputEvent ? InputEventInit : E extends ClipboardEvent ? ClipboardEventInit : E extends KeyboardEvent ? KeyboardEventInit : E extends PointerEvent ? PointerEventInit : E extends MouseEvent ? MouseEventInit : E extends UIEvent ? UIEventInit : EventInit; | ||
export declare function createEvent<K extends EventType>(type: K, target: Element, init?: EventTypeInit<K>): DocumentEventMap[K]; | ||
export {}; | ||
import type { EventType, EventTypeInit, FixedDocumentEventMap } from './types'; | ||
export declare function createEvent<K extends EventType>(type: K, target: Element, init?: EventTypeInit<K>): FixedDocumentEventMap[K]; |
@@ -0,356 +1,377 @@ | ||
import { EventType } from './types'; | ||
export declare const eventMap: { | ||
beforeInput: { | ||
EventType: string; | ||
defaultInit: { | ||
bubbles: boolean; | ||
cancelable: boolean; | ||
composed: boolean; | ||
readonly click: { | ||
readonly EventType: "PointerEvent"; | ||
readonly defaultInit: { | ||
readonly bubbles: true; | ||
readonly cancelable: true; | ||
readonly composed: true; | ||
}; | ||
}; | ||
input: { | ||
EventType: string; | ||
defaultInit: EventInit; | ||
readonly auxclick: { | ||
readonly EventType: "PointerEvent"; | ||
readonly defaultInit: { | ||
readonly bubbles: true; | ||
readonly cancelable: true; | ||
readonly composed: true; | ||
}; | ||
}; | ||
progress: { | ||
EventType: string; | ||
readonly contextmenu: { | ||
readonly EventType: "PointerEvent"; | ||
readonly defaultInit: { | ||
readonly bubbles: true; | ||
readonly cancelable: true; | ||
readonly composed: true; | ||
}; | ||
}; | ||
readonly beforeInput: { | ||
readonly EventType: "InputEvent"; | ||
readonly defaultInit: { | ||
readonly bubbles: true; | ||
readonly cancelable: true; | ||
readonly composed: true; | ||
}; | ||
}; | ||
readonly input: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
select: { | ||
EventType: string; | ||
readonly progress: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
scroll: { | ||
EventType: string; | ||
readonly select: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
reset: { | ||
EventType: string; | ||
readonly scroll: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
submit: { | ||
EventType: string; | ||
readonly copy: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
copy: { | ||
EventType: string; | ||
readonly blur: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
click: { | ||
EventType: string; | ||
readonly focus: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
blur: { | ||
EventType: string; | ||
readonly cut: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
focus: { | ||
EventType: string; | ||
readonly paste: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
cut: { | ||
EventType: string; | ||
readonly abort: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
paste: { | ||
EventType: string; | ||
readonly change: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
abort: { | ||
EventType: string; | ||
readonly drag: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
change: { | ||
EventType: string; | ||
readonly drop: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
drag: { | ||
EventType: string; | ||
readonly emptied: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
drop: { | ||
EventType: string; | ||
readonly ended: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
emptied: { | ||
EventType: string; | ||
readonly error: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
ended: { | ||
EventType: string; | ||
readonly invalid: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
error: { | ||
EventType: string; | ||
readonly load: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
invalid: { | ||
EventType: string; | ||
readonly pause: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
load: { | ||
EventType: string; | ||
readonly play: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pause: { | ||
EventType: string; | ||
readonly playing: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
play: { | ||
EventType: string; | ||
readonly reset: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
playing: { | ||
EventType: string; | ||
readonly resize: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
resize: { | ||
EventType: string; | ||
readonly seeked: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
seeked: { | ||
EventType: string; | ||
readonly seeking: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
seeking: { | ||
EventType: string; | ||
readonly stalled: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
stalled: { | ||
EventType: string; | ||
readonly submit: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
suspend: { | ||
EventType: string; | ||
readonly suspend: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
waiting: { | ||
EventType: string; | ||
readonly waiting: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
wheel: { | ||
EventType: string; | ||
readonly wheel: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
compositionEnd: { | ||
EventType: string; | ||
readonly compositionEnd: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
compositionStart: { | ||
EventType: string; | ||
readonly compositionStart: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
compositionUpdate: { | ||
EventType: string; | ||
readonly compositionUpdate: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
keyDown: { | ||
EventType: string; | ||
readonly keyDown: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
keyPress: { | ||
EventType: string; | ||
readonly keyPress: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
keyUp: { | ||
EventType: string; | ||
readonly keyUp: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
focusIn: { | ||
EventType: string; | ||
readonly focusIn: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
focusOut: { | ||
EventType: string; | ||
readonly focusOut: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
contextMenu: { | ||
EventType: string; | ||
readonly contextMenu: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dblClick: { | ||
EventType: string; | ||
readonly dblClick: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dragEnd: { | ||
EventType: string; | ||
readonly dragEnd: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dragEnter: { | ||
EventType: string; | ||
readonly dragEnter: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dragExit: { | ||
EventType: string; | ||
readonly dragExit: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dragLeave: { | ||
EventType: string; | ||
readonly dragLeave: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dragOver: { | ||
EventType: string; | ||
readonly dragOver: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
dragStart: { | ||
EventType: string; | ||
readonly dragStart: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseDown: { | ||
EventType: string; | ||
readonly mouseDown: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseEnter: { | ||
EventType: string; | ||
readonly mouseEnter: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseLeave: { | ||
EventType: string; | ||
readonly mouseLeave: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseMove: { | ||
EventType: string; | ||
readonly mouseMove: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseOut: { | ||
EventType: string; | ||
readonly mouseOut: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseOver: { | ||
EventType: string; | ||
readonly mouseOver: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
mouseUp: { | ||
EventType: string; | ||
readonly mouseUp: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
popState: { | ||
EventType: string; | ||
readonly popState: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
touchCancel: { | ||
EventType: string; | ||
readonly touchCancel: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
touchEnd: { | ||
EventType: string; | ||
readonly touchEnd: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
touchMove: { | ||
EventType: string; | ||
readonly touchMove: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
touchStart: { | ||
EventType: string; | ||
readonly touchStart: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
canPlay: { | ||
EventType: string; | ||
readonly canPlay: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
canPlayThrough: { | ||
EventType: string; | ||
readonly canPlayThrough: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
durationChange: { | ||
EventType: string; | ||
readonly durationChange: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
encrypted: { | ||
EventType: string; | ||
readonly encrypted: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
loadedData: { | ||
EventType: string; | ||
readonly loadedData: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
loadedMetadata: { | ||
EventType: string; | ||
readonly loadedMetadata: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
loadStart: { | ||
EventType: string; | ||
readonly loadStart: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
rateChange: { | ||
EventType: string; | ||
readonly rateChange: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
timeUpdate: { | ||
EventType: string; | ||
readonly timeUpdate: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
volumeChange: { | ||
EventType: string; | ||
readonly volumeChange: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
animationStart: { | ||
EventType: string; | ||
readonly animationStart: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
animationEnd: { | ||
EventType: string; | ||
readonly animationEnd: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
animationIteration: { | ||
EventType: string; | ||
readonly animationIteration: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
transitionCancel: { | ||
EventType: string; | ||
readonly transitionCancel: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
transitionEnd: { | ||
EventType: string; | ||
readonly transitionEnd: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
transitionRun: { | ||
EventType: string; | ||
readonly transitionRun: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
transitionStart: { | ||
EventType: string; | ||
readonly transitionStart: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
doubleClick: { | ||
EventType: string; | ||
readonly doubleClick: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerOver: { | ||
EventType: string; | ||
readonly pointerOver: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerEnter: { | ||
EventType: string; | ||
readonly pointerEnter: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerDown: { | ||
EventType: string; | ||
readonly pointerDown: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerMove: { | ||
EventType: string; | ||
readonly pointerMove: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerUp: { | ||
EventType: string; | ||
readonly pointerUp: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerCancel: { | ||
EventType: string; | ||
readonly pointerCancel: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerOut: { | ||
EventType: string; | ||
readonly pointerOut: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
pointerLeave: { | ||
EventType: string; | ||
readonly pointerLeave: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
gotPointerCapture: { | ||
EventType: string; | ||
readonly gotPointerCapture: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
}; | ||
lostPointerCapture: { | ||
EventType: string; | ||
readonly lostPointerCapture: { | ||
EventType: EventInterface; | ||
defaultInit: EventInit; | ||
@@ -362,1 +383,3 @@ }; | ||
}; | ||
export declare function isMouseEvent(type: EventType): boolean; | ||
export declare function isKeyboardEvent(type: EventType): boolean; |
import { Config } from '../setup'; | ||
import { EventTypeInit } from './createEvent'; | ||
import { EventType, PointerCoords } from './types'; | ||
import { EventType, EventTypeInit, PointerCoords } from './types'; | ||
export type { EventType, PointerCoords }; | ||
export declare function dispatchUIEvent<K extends EventType>(config: Config, target: Element, type: K, init?: EventTypeInit<K>, preventDefault?: boolean): boolean; | ||
export declare function bindDispatchUIEvent(config: Config): (target: Element, type: keyof DocumentEventMap, init?: InputEventInit | UIEventInit | EventInit | ClipboardEventInit | MouseEventInit | PointerEventInit | KeyboardEventInit | undefined, preventDefault?: boolean | undefined) => boolean; |
export declare type EventType = keyof DocumentEventMap; | ||
export declare type EventTypeInit<K extends EventType> = SpecificEventInit<FixedDocumentEventMap[K]>; | ||
export interface FixedDocumentEventMap extends DocumentEventMap { | ||
input: InputEvent; | ||
} | ||
declare type SpecificEventInit<E extends Event> = E extends InputEvent ? InputEventInit : E extends ClipboardEvent ? ClipboardEventInit : E extends KeyboardEvent ? KeyboardEventInit : E extends PointerEvent ? PointerEventInit : E extends MouseEvent ? MouseEventInit : E extends UIEvent ? UIEventInit : EventInit; | ||
export interface PointerCoords { | ||
@@ -14,1 +19,2 @@ x?: number; | ||
} | ||
export {}; |
export { userEvent as default } from './setup'; | ||
export type { keyboardKey } from './keyboard'; | ||
export type { pointerKey } from './pointer'; | ||
export type { keyboardKey } from './system/keyboard'; | ||
export type { pointerKey } from './system/pointer'; | ||
export { PointerEventsCheckLevel } from './options'; |
@@ -1,7 +0,3 @@ | ||
import { Instance } from '../setup'; | ||
import { releaseAllKeys } from './keyboardAction'; | ||
import type { keyboardState, keyboardKey } from './types'; | ||
export { releaseAllKeys }; | ||
export type { keyboardKey, keyboardState }; | ||
import { Config, Instance } from '../setup'; | ||
export declare function keyboard(this: Instance, text: string): Promise<void>; | ||
export declare function createKeyboardState(): keyboardState; | ||
export declare function releaseAllKeys(config: Config): Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import { keyboardKey } from './types'; | ||
import { keyboardKey } from '../system/keyboard'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Mapping for a default US-104-QWERTY keyboard |
@@ -1,2 +0,2 @@ | ||
import { keyboardKey } from './types'; | ||
import { keyboardKey } from '../system/keyboard'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Parse key defintions per `keyboardMap` |
@@ -1,3 +0,3 @@ | ||
import type { keyboardKey } from './keyboard/types'; | ||
import type { pointerKey } from './pointer/types'; | ||
import type { keyboardKey } from './system/keyboard'; | ||
import type { pointerKey } from './system/pointer'; | ||
export declare enum PointerEventsCheckLevel { | ||
@@ -86,3 +86,3 @@ /** | ||
/** | ||
* `userEvent.type` implys a click at the end of the element content/value. | ||
* `userEvent.type` implies a click at the end of the element content/value. | ||
* This option allows to opt out of this feature. | ||
@@ -94,3 +94,3 @@ * | ||
/** | ||
* `userEvent.click` implys moving the cursor to the target element first. | ||
* `userEvent.click` implies moving the cursor to the target element first. | ||
* This options allows to opt out of this feature. | ||
@@ -97,0 +97,0 @@ * |
@@ -0,10 +1,28 @@ | ||
import { PointerCoords } from '../event'; | ||
import { Instance } from '../setup'; | ||
import { PointerAction, PointerActionTarget } from './pointerAction'; | ||
import type { pointerState, pointerKey } from './types'; | ||
export type { pointerState, pointerKey }; | ||
import { pointerKey } from '../system/pointer'; | ||
declare type PointerActionInput = string | ({ | ||
keys: string; | ||
} & PointerActionTarget) | PointerAction; | ||
} & PointerActionPosition) | PointerAction; | ||
export declare type PointerInput = PointerActionInput | Array<PointerActionInput>; | ||
declare type PointerAction = PointerPressAction | PointerMoveAction; | ||
declare type PointerActionPosition = { | ||
target?: Element; | ||
coords?: PointerCoords; | ||
node?: Node; | ||
/** | ||
* If `node` is set, this is the DOM offset. | ||
* Otherwise this is the `textContent`/`value` offset on the `target`. | ||
*/ | ||
offset?: number; | ||
}; | ||
interface PointerPressAction extends PointerActionPosition { | ||
keyDef: pointerKey; | ||
releasePrevious: boolean; | ||
releaseSelf: boolean; | ||
} | ||
interface PointerMoveAction extends PointerActionPosition { | ||
pointerName?: string; | ||
} | ||
export declare function pointer(this: Instance, input: PointerInput): Promise<void>; | ||
export declare function createPointerState(document: Document): pointerState; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { pointerKey } from './types'; | ||
import { pointerKey } from '../system/pointer'; | ||
export declare const defaultKeyMap: pointerKey[]; |
@@ -1,2 +0,2 @@ | ||
import { pointerKey } from './types'; | ||
import { pointerKey } from '../system/pointer'; | ||
export declare function parseKeyDef(pointerMap: pointerKey[], keys: string): { | ||
@@ -3,0 +3,0 @@ keyDef: pointerKey; |
@@ -1,10 +0,6 @@ | ||
import type { keyboardState } from '../keyboard/types'; | ||
import type { pointerState } from '../pointer/types'; | ||
import type { Options } from '../options'; | ||
export interface inputDeviceState { | ||
pointerState: pointerState; | ||
keyboardState: keyboardState; | ||
import { System } from '../system'; | ||
export interface Config extends Required<Options> { | ||
system: System; | ||
} | ||
export interface Config extends Required<Options>, inputDeviceState { | ||
} | ||
export declare const Config: unique symbol; |
@@ -0,19 +1,24 @@ | ||
import type { Options } from '../options'; | ||
import type { PointerInput } from '../pointer'; | ||
import type { System } from '../system'; | ||
import type { UserEventApi } from '.'; | ||
import { Config } from './config'; | ||
export declare type DirectOptions = Options & { | ||
keyboardState?: System; | ||
pointerState?: System; | ||
}; | ||
export declare function clear(element: Element): Promise<void>; | ||
export declare function click(element: Element, options?: Partial<Config>): Promise<void>; | ||
export declare function copy(options?: Partial<Config>): Promise<DataTransfer | undefined>; | ||
export declare function cut(options?: Partial<Config>): Promise<DataTransfer | undefined>; | ||
export declare function dblClick(element: Element, options?: Partial<Config>): Promise<void>; | ||
export declare function deselectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: Partial<Config>): Promise<void>; | ||
export declare function hover(element: Element, options?: Partial<Config>): Promise<void>; | ||
export declare function keyboard(text: string, options?: Partial<Config>): Promise<import("../keyboard").keyboardState>; | ||
export declare function pointer(input: PointerInput, options?: Partial<Config>): Promise<import("../pointer").pointerState>; | ||
export declare function paste(clipboardData?: DataTransfer | string, options?: Partial<Config>): Promise<void>; | ||
export declare function selectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: Partial<Config>): Promise<void>; | ||
export declare function tripleClick(element: Element, options?: Partial<Config>): Promise<void>; | ||
export declare function type(element: Element, text: string, options?: Partial<Config> & Parameters<UserEventApi['type']>[2]): Promise<void>; | ||
export declare function unhover(element: Element, options?: Partial<Config>): Promise<void>; | ||
export declare function upload(element: HTMLElement, fileOrFiles: File | File[], options?: Partial<Config>): Promise<void>; | ||
export declare function tab(options?: Partial<Config> & Parameters<UserEventApi['tab']>[0]): Promise<void>; | ||
export declare function click(element: Element, options?: DirectOptions): Promise<void>; | ||
export declare function copy(options?: DirectOptions): Promise<DataTransfer | undefined>; | ||
export declare function cut(options?: DirectOptions): Promise<DataTransfer | undefined>; | ||
export declare function dblClick(element: Element, options?: DirectOptions): Promise<void>; | ||
export declare function deselectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: DirectOptions): Promise<void>; | ||
export declare function hover(element: Element, options?: DirectOptions): Promise<void>; | ||
export declare function keyboard(text: string, options?: DirectOptions): Promise<System>; | ||
export declare function pointer(input: PointerInput, options?: DirectOptions): Promise<System>; | ||
export declare function paste(clipboardData?: DataTransfer | string, options?: DirectOptions): Promise<void>; | ||
export declare function selectOptions(select: Element, values: HTMLElement | HTMLElement[] | string[] | string, options?: DirectOptions): Promise<void>; | ||
export declare function tripleClick(element: Element, options?: DirectOptions): Promise<void>; | ||
export declare function type(element: Element, text: string, options?: DirectOptions & Parameters<UserEventApi['type']>[2]): Promise<void>; | ||
export declare function unhover(element: Element, options?: DirectOptions): Promise<void>; | ||
export declare function upload(element: HTMLElement, fileOrFiles: File | File[], options?: DirectOptions): Promise<void>; | ||
export declare function tab(options?: DirectOptions & Parameters<UserEventApi['tab']>[0]): Promise<void>; |
import type { bindDispatchUIEvent } from '../event'; | ||
import type * as userEventApi from './api'; | ||
import { setupMain, setupSub } from './setup'; | ||
import { Config, inputDeviceState } from './config'; | ||
import { Config } from './config'; | ||
import * as directApi from './directApi'; | ||
export type { inputDeviceState }; | ||
export { Config }; | ||
@@ -8,0 +7,0 @@ export declare type UserEventApi = typeof userEventApi; |
import { Options } from '../options'; | ||
import { System } from '../system'; | ||
import type { Instance, UserEvent } from './index'; | ||
import { Config } from './config'; | ||
import { DirectOptions } from './directApi'; | ||
export declare function createConfig(options?: Partial<Config>, defaults?: Required<Options>, node?: Node): Config; | ||
@@ -13,3 +15,7 @@ /** | ||
*/ | ||
export declare function setupDirect(options?: Partial<Config>, node?: Node): { | ||
export declare function setupDirect({ keyboardState, pointerState, ...options }?: DirectOptions & // backward-compatibility | ||
{ | ||
keyboardState?: System; | ||
pointerState?: System; | ||
}, node?: Node): { | ||
config: Config; | ||
@@ -16,0 +22,0 @@ api: UserEvent; |
@@ -1,1 +0,15 @@ | ||
export declare function isClickableInput(element: Element): boolean; | ||
declare enum clickableInputTypes { | ||
'button' = "button", | ||
'color' = "color", | ||
'file' = "file", | ||
'image' = "image", | ||
'reset' = "reset", | ||
'submit' = "submit", | ||
'checkbox' = "checkbox", | ||
'radio' = "radio" | ||
} | ||
export declare type ClickableInputType = keyof typeof clickableInputTypes; | ||
export declare function isClickableInput(element: Element): element is HTMLButtonElement | (HTMLInputElement & { | ||
type: clickableInputTypes; | ||
}); | ||
export {}; |
export declare function getActiveElement(document: Document | ShadowRoot): Element | null; | ||
export declare function getActiveElementOrBody(document: Document): Element; |
import { UISelectionRange } from '../../document'; | ||
import { editableInputTypes } from '../edit/isEditable'; | ||
import { EditableInputType, editableInputTypes } from '../edit/isEditable'; | ||
/** | ||
@@ -16,2 +16,3 @@ * Backward-compatible selection. | ||
}); | ||
export declare function hasNoSelection(node: Node): boolean; | ||
/** | ||
@@ -48,1 +49,27 @@ * Reset the Document Selection when moving focus into an element | ||
export declare function moveSelection(node: Element, direction: -1 | 1): void; | ||
export declare type SelectionRange = { | ||
node: (HTMLInputElement & { | ||
type: EditableInputType; | ||
}) | HTMLTextAreaElement; | ||
start: number; | ||
end: number; | ||
}; | ||
export declare function setSelectionPerMouseDown({ document, target, clickCount, node, offset, }: { | ||
document: Document; | ||
target: Element; | ||
clickCount: number; | ||
node?: Node; | ||
offset?: number; | ||
}): Range | { | ||
node: HTMLTextAreaElement | (HTMLInputElement & { | ||
type: editableInputTypes; | ||
}); | ||
start: number; | ||
end: number; | ||
} | undefined; | ||
export declare function modifySelectionPerMouseMove(selectionRange: Range | SelectionRange, { document, target, node, offset, }: { | ||
document: Document; | ||
target: Element; | ||
node?: Node; | ||
offset?: number; | ||
}): void; |
@@ -20,6 +20,5 @@ export * from './click/isClickableInput'; | ||
export * from './focus/selectAll'; | ||
export * from './focus/resolveCaretPosition'; | ||
export * from './focus/selection'; | ||
export * from './focus/selector'; | ||
export * from './keyboard/getKeyEventProps'; | ||
export * from './keyboard/getUIEventModifiers'; | ||
export * from './keyDef/readNextDescriptor'; | ||
@@ -30,2 +29,3 @@ export * from './misc/cloneEvent'; | ||
export * from './misc/getDocumentFromNode'; | ||
export * from './misc/getTreeDiff'; | ||
export * from './misc/getWindow'; | ||
@@ -39,2 +39,1 @@ export * from './misc/isDescendantOrSelf'; | ||
export * from './pointer/cssPointerEvents'; | ||
export * from './pointer/mouseButtons'; |
{ | ||
"name": "@testing-library/user-event", | ||
"version": "14.3.0", | ||
"version": "14.4.0", | ||
"description": "Fire events the same way the user does", | ||
@@ -28,13 +28,4 @@ "keywords": [ | ||
], | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.cjs", | ||
"default": "./dist/index.mjs" | ||
} | ||
}, | ||
"types": "./dist/types/index.d.ts", | ||
"scripts": { | ||
"build": "node build.js", | ||
"build": "scripts ts-build2 --cjs", | ||
"lint": "kcd-scripts lint", | ||
@@ -45,6 +36,6 @@ "setup": "npm install && npm run validate -s", | ||
"test:update": "npm test -- --updateSnapshot --coverage", | ||
"validate": "kcd-scripts validate", | ||
"typecheck": "kcd-scripts typecheck" | ||
"validate": "kcd-scripts typecheck" | ||
}, | ||
"devDependencies": { | ||
"@ph.fritsche/scripts-config": "^2.2.4", | ||
"@testing-library/dom": "^8.11.4", | ||
@@ -55,3 +46,2 @@ "@testing-library/jest-dom": "^5.16.3", | ||
"@types/react": "^17.0.42", | ||
"esbuild": "^0.14.27", | ||
"eslint-import-resolver-typescript": "^2.7.0", | ||
@@ -69,2 +59,3 @@ "eslint-plugin-local-rules": "^1.1.0", | ||
"reactTesting17": "npm:@testing-library/react@^12.1.3", | ||
"shared-scripts": "^1.5.1", | ||
"typescript": "^4.1.2" | ||
@@ -74,3 +65,6 @@ }, | ||
"@testing-library/dom": ">=7.21.4" | ||
} | ||
}, | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"types": "./dist/types/index.d.ts" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
400722
288
10503
20
1