@ember/test-helpers
Version:
Helpers for testing Ember.js applications
30 lines (29 loc) • 1.22 kB
TypeScript
import { type Target } from './-target.ts';
export interface Options {
delay?: number;
}
/**
* Mimics character by character entry into the target `input` or `textarea` element.
*
* Allows for simulation of slow entry by passing an optional millisecond delay
* between key events.
* The major difference between `typeIn` and `fillIn` is that `typeIn` triggers
* keyboard events as well as `input` and `change`.
* Typically this looks like `focus` -> `focusin` -> `keydown` -> `keypress` -> `keyup` -> `input` -> `change`
* per character of the passed text (this may vary on some browsers).
*
* @public
* @param {string|Element|IDOMElementDescriptor} target the element, selector, or descriptor to enter text into
* @param {string} text the test to fill the element with
* @param {Object} options {delay: x} (default 50) number of milliseconds to wait per keypress
* @return {Promise<void>} resolves when the application is settled
*
* @example
* <caption>
* Emulating typing in an input using `typeIn`
* </caption>
*
* typeIn('input', 'hello world');
*/
export default function typeIn(target: Target, text: string, options?: Options): Promise<void>;
//# sourceMappingURL=type-in.d.ts.map