import { IDropEvent } from './events'; import { IKey, IKeyModifier, Key } from './key'; type KeyOrKeyName = (IKey | keyof Key); /** * Most `unit tests` require user interaction, this collection aims to simplify event dispatching, * by providing a collection of methods and properties that create the most often required `UIEvents`. * * @export * @dynamic */ export declare class EventGenerator { /** * A cursor utility that draws a cursor icon over the tested component. * * Very useful when testing hover effects. * */ static cursor: { ref: HTMLElement; initialize: (parent?: HTMLElement) => void; destroy: (parent?: HTMLElement) => void; update: (x: number, y: number) => void; }; /** * Gets a `click` event. * */ static get click(): MouseEvent; /** * Gets a `mouseenter` event. * */ static get mouseEnter(): MouseEvent; /** * Gets a `mouseleave` event. * */ static get mouseLeave(): MouseEvent; /** * Gets a `dblclick` event. * */ static get doubleClick(): MouseEvent; /** * Gets a `dragover` event. * */ static get dragOver(): Event; /** * Gets a `dragleave` event. * */ static get dragLeave(): Event; /** * Gets a `dragEnd` event. * */ static get dragEnd(): Event; /** * KeyDown event generator helper. * * @param key The pressed key. * @param [modifiers] The active modifiers, if any. * @returns A `keydown` event with the provided key and modifier metadata. */ static keyDown(key: KeyOrKeyName, ...modifiers: IKeyModifier[]): KeyboardEvent; /** * KeyUp event generator helper. * * @param key The pressed key. * @param [modifiers] The active modifier, if any. * @returns A `keyup` event with the provided key and modifier metadata. */ static keyUp(key: KeyOrKeyName, ...modifiers: IKeyModifier[]): KeyboardEvent; /** * Drop event generator, helpful for testing `HTMLInputElement`s of type `file`. * * @param [files=[]] A list of files to associated to the event. * @returns The drop event with the `dataTransfer` and `files` properties populated. */ static drop(files?: File[]): IDropEvent; /** * Change event generator helpful for testing `HTMLInputElement`s. * * @returns A simple `change` event. */ static change(): Event; /** * Generates an input event helpful for testing `HTMLInputElement`s. * * @returns A simple `input` event. */ static input(): Event; /** * Generates a `click` event on the requested X, Y coordinates. * * @param offsetX The X offset value. * @param offsetY The Y offset value. * @returns A `click` event with the `offsetX` and `offsetY` properties populated. */ static clickXY(offsetX: number, offsetY: number): MouseEvent; /** * Generates a `mousemove` event on the requested X, Y coordinates. * * @param offsetX The X offset value. * @param offsetY The Y offset value. * @returns A `mousemove` event with the `offsetX` and `offsetY` properties populated. */ static moveXY(offsetX: number, offsetY: number): MouseEvent; private static _key; private static _getKey; } export {};