Methods

Table of Contents

triggerable

Triggers event on element matched by selector.

Parameters

  • event string Event to be triggered
  • selector string CSS selector of the element on which the event will be triggered
  • userOptions (optional, default {})
  • options Object Additional options

    • options.scope string Nests provided scope within parent’s scope
    • options.at number Reduce the set of matched elements to the one at the specified index
    • options.resetScope boolean Ignore parent scope
    • options.testContainer string Context where to search elements in the DOM
    • options.eventProperties string Event properties that will be passed to trigger function

Examples

// <input class="name">
// <input class="email">

import { create, triggerable } from 'ember-cli-page-object';

const page = create({
  enter: triggerable('keypress', '.name', { eventProperties: { keyCode: 13 } })
});

// triggers keypress using enter key on element with selector '.name'
await page.enter();
// <input class="name">
// <input class="email">

import { create, triggerable } from 'ember-cli-page-object';

const page = create({
  keydown: triggerable('keypress', '.name')
});

// triggers keypress using enter key on element with selector '.name'
await page.keydown({ which: 13 });
// <div class="scope">
//   <input class="name">
// </div>
// <input class="email">

import { create, triggerable } from 'ember-cli-page-object';

const page = create({
  keydown: triggerable('keypress', '.name', { scope: '.scope' })
});

// triggers keypress using enter key on element with selector '.name'
await page.keydown({ which: 13 });
// <div class="scope">
//   <input class="name">
// </div>
// <input class="email">

import { create, triggerable } from 'ember-cli-page-object';

const page = create({
  scope: '.scope',
  keydown: triggerable('keypress', '.name')
});

// triggers keypress using enter key on element with selector '.name'
await page.keydown({ which: 13 });

Returns Descriptor