/** * Returns a promise that resolves after the specified number of milliseconds. * @param ms - Number of milliseconds to wait * @returns Promise that resolves after the specified number of milliseconds * @example * ```typescript * await aTimeout(1000) * ``` */ export declare function aTimeout(ms?: number): Promise; /** * Returns a promise that resolves after the next browser animation frame. * @returns Promise that resolves after the next browser animation frame * @example * ```typescript * await nextFrame() * ``` */ export declare function nextFrame(): Promise; /** * Returns a promise that resolves when the specified event is dispatched on the element. * @template T - Type of the event detail, only relevant for CustomEvents * @template E - Type of the event, defaults to CustomEvent * @param eventTarget - Target of the event, usually an EventTarget * @param eventName - Name of the event to wait for * @returns Promise that resolves when the specified event is dispatched on the element * @example * ```typescript * const event = await oneEvent(element, 'click') * assert.strictEqual(event.type, 'click') * ``` */ export declare function oneEvent>(element: EventTarget, eventName: string): Promise; /** * Polls the condition function until it returns true or the timeout is reached. * * @remarks * If the condition function throws an error, the error is suppressed and the polling * continues until the condition returns true or the timeout expires. The `interval` * option determines the delay between polling attempts (default is 50ms), and the * `timeout` option determines the maximum total duration before the promise rejects * with the provided `message` (default is 1000ms). * * @param condition - Function to poll * @param message - Message to use when throwing an error * @param options - Options for waitUntil * @returns Promise that resolves when the condition is met * @example * ```typescript * await waitUntil(() => element.textContent === 'Hello') * ``` */ export declare function waitUntil(condition: () => boolean | Promise, message?: string, options?: { timeout?: number; interval?: number; }): Promise; /** * Listens for one event, calls `event.preventDefault()` and resolves with this event object after it was fired. * * @example * ```typescript * const form = document.querySelector('form') * form.querySelector('button[type="submit"]).click() * const event = await oneDefaultPreventedEvent(form, 'submit') * assert.isTrue(event.defaultPrevented) * ``` * @template T - Type of the event detail, only relevant for CustomEvents * @template E - Type of the event, defaults to CustomEvent * @param eventTarget Target of the event, usually an Element * @param eventName Name of the event * @returns Promise to await until the event has been fired */ export declare function oneDefaultPreventedEvent>(eventTarget: EventTarget, eventName: string): Promise; /** * Type representing all standard drag-and-drop event names. */ export type DragEventType = 'drag' | 'dragend' | 'dragenter' | 'dragleave' | 'dragover' | 'dragstart' | 'drop'; /** * Creates a browser-side custom file DragEvent that can be dispatched to elements. * * @use when * - Testing drag-and-drop file upload zones inside tests. * * @dont use when * - Simulating user mouse drag-and-drop of elements on the page (use `query().dragTo()` instead). * * @example * ```typescript * import { createFileDragEvent } from '@pawel-up/lupa/testing' * * const file = new File(['hello'], 'hello.txt', { type: 'text/plain' }) * const event = createFileDragEvent('drop', [file]) * dropzone.dispatchEvent(event) * ``` * * @param type - Standard drag event name (e.g. 'dragover', 'drop'). * @param files - Array of standard DOM Files to attach to the dataTransfer property. * @param options - Custom event init options to merge. * @returns A standard DOM DragEvent populated with the files. */ export declare function createFileDragEvent(type: DragEventType, files: File[], options?: DragEventInit): DragEvent;