Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a triggerEvent doc example #1140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions addon-test-support/@ember/test-helpers/dom/trigger-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ registerHook('triggerEvent', 'start', (target: Target, eventType: string) => {
* }
* }
* )
*
*
* @example
* <caption>
* Using `triggerEvent` to simulate a mouseleave event
*
* `triggerEvent` provides a way to to trigger any [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event).
* The `options` param can contain any sub set of properties from each of the Event sub-types.
* If supplied, the `options.relatedTarget` has to be an HTML `Element`.
* </caption>
*
* const target = find('#zone')
* triggerEvent(
* target,
* 'mouseleave',
* { relatedTarget: target }
* )
*/
export default function triggerEvent(
target: Target,
Expand Down