@testing-library/user-event
Version:
Fire events the same way the user does
40 lines (39 loc) • 1.46 kB
TypeScript
import { System } from '..';
import { PointerCoords } from '../../event';
import { Config } from '../../setup';
import { MouseButton } from './buttons';
export interface pointerKey {
/** Name of the pointer key */
name: string;
/** Type of the pointer device */
pointerType: 'mouse' | 'pen' | 'touch';
/** Type of button */
button?: MouseButton;
}
export interface PointerPosition {
target?: Element;
coords?: PointerCoords;
caret?: CaretPosition;
}
export interface CaretPosition {
node?: Node;
offset?: number;
}
export declare class PointerHost {
readonly system: System;
constructor(system: System);
private readonly mouse;
private readonly buttons;
private readonly devices;
private readonly pointers;
isKeyPressed(keyDef: pointerKey): boolean;
press(config: Config, keyDef: pointerKey, position: PointerPosition): Promise<void>;
move(config: Config, pointerName: string, position: PointerPosition): Promise<void>;
release(config: Config, keyDef: pointerKey, position: PointerPosition): Promise<void>;
getPointerName(keyDef: pointerKey): string;
getPreviousPosition(pointerName: string): PointerPosition | undefined;
resetClickCount(): void;
getMouseTarget(config: Config): Element;
setMousePosition(position: PointerPosition): void;
}
export declare function isDifferentPointerPosition(positionA: PointerPosition, positionB: PointerPosition): boolean;