import { EventType } from '@testing-library/react/pure'; import { Selector } from './find'; export type FireObject = { [E in EventType]: (selector: Selector, options?: object) => void; }; /** * fireEvent from @testing-library/react that also accepts jQuery collections. * * @see https://testing-library.com/docs/dom-testing-library/api-events#fireevent-eventname * * @example * $fireEvent.click('button') // CSS selector * $fireEvent.click($component.find('button.primary')) // jQuery element * $fireEvent.click($component.find('button')[2]) // DOM element */ export declare const $fireEvent: FireObject; /** * Simulate a left click. Can be used to toggle checkboxes/radios. * * @param selector If it's a string, the first element identified * by this will receive the event. If it's a jQuery collection * then the first element in it will receive the event. * * @example * click('button') * click('input[type=checkbox]') * click('input[type=radio]') * click($component.find('button.primary')) * click($component.find('button')[2]) */ export declare function $click(selector: Selector): void; /** * Simulate a change event. * * @param selector If it's a string, the first element identified * by this will receive the event. If it's a jQuery collection * then the first element in it will receive the event. * @param value The entire value will be sent at once to the target. * * @example * change('input', 'foobar') * change($component.find('input[type=password]'), 'foobar') * change($component.find('input')[2], 'foobar') */ export declare function $change(selector: Selector, value: string): void; /** * Simulate a keyDown event. * * @param selector If it's a string, the first element identified * by this will receive the event. If it's a jQuery collection * then the first element in it will receive the event. * @param key See `key` from https://keycode.info/. * @param keyCode See `which` from https://keycode.info/. If not provided * it will default to the char code for the first char in `key`. * * @example * keyDown('input', 'a') * keyDown('input', 'A', 65) * keyDown('input', 'Enter', 13) */ export declare function $keyDown(selector: Selector, key: string, keyCode?: number): void; /** * Submit a form. * * You can fire the event on a form or on a linked submit button. The * submit button either has to be inside the `
` element, or linked * to it via the `form` attribute. * * @param selector If it's a string, the first element identified * by this will receive the event. If it's a jQuery collection * then the first element in it will receive the event. * * @example * $render( {}} />); * $submit('form') * * @example * $render( {}}> * *
); * $submit('button'); * * @example * $render(<> *
{}} /> * * ); * $submit('button'); */ export declare function $submit(selector: Selector): void;