@ember/test-helpers
Version:
Helpers for testing Ember.js applications
63 lines (52 loc) • 2.05 kB
TypeScript
import { type Target } from './-target.ts';
/**
* Represent a particular mouse button being clicked.
* See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons for available options.
*/
export declare const DEFAULT_CLICK_OPTIONS: {
buttons: number;
button: number;
};
/**
@private
@param {Element} element the element to click on
@param {MouseEventInit} options the options to be merged into the mouse events
@return {Promise<Event | void>} resolves when settled
*/
export declare function __click__(element: Element | Document | Window, options: MouseEventInit): Promise<Event | void>;
/**
Clicks on the specified target.
Sends a number of events intending to simulate a "real" user clicking on an
element.
For non-focusable elements the following events are triggered (in order):
- `mousedown`
- `mouseup`
- `click`
For focusable (e.g. form control) elements the following events are triggered
(in order):
- `mousedown`
- `focus`
- `focusin`
- `mouseup`
- `click`
The exact listing of events that are triggered may change over time as needed
to continue to emulate how actual browsers handle clicking a given element.
Use the `options` hash to change the parameters of the [MouseEvents](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent).
You can use this to specify modifier keys as well.
@public
@param {string|Element|IDOMElementDescriptor} target the element, selector, or descriptor to click on
@param {MouseEventInit} _options the options to be merged into the mouse events.
@return {Promise<void>} resolves when settled
@example
<caption>
Emulating clicking a button using `click`
</caption>
click('button');
@example
<caption>
Emulating clicking a button and pressing the `shift` key simultaneously using `click` with `options`.
</caption>
click('button', { shiftKey: true });
*/
export default function click(target: Target, _options?: MouseEventInit): Promise<void>;
//# sourceMappingURL=click.d.ts.map