Methods

Table of Contents

property

Parameters

  • propertyName string Name of the property to get
  • selector string CSS selector of the element to check
  • userOptions (optional, default {})
  • options Object Additional options
    • options.scope string Nests provided scope within parent’s scope
    • options.resetScope boolean Override parent’s scope
    • options.at number Reduce the set of matched elements to the one at the specified index
    • options.multiple boolean If set, the function will return an array of values

Examples

// <input type="checkbox" checked="checked">

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

const page = create({
  isChecked: property('checked', 'input')
});

assert.ok(page.isChecked);
// <input type="checkbox" checked="checked">
// <input type="checkbox" checked="">

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

const page = create({
  inputsChecked: property('checked', 'input', { multiple: true })
});

assert.deepEqual(page.inputsChecked, [true, false]);
// <div><input></div>
// <div class="scope"><input type="checkbox" checked="checked"></div>
// <div><input></div>

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

const page = create({
  isChecked: property('checked', 'input', { scope: '.scope' })
});

assert.ok(page.isChecked);
  • Throws any Will throw an error if no element matches selector
  • Throws any Will throw an error if multiple elements are matched by selector and multiple option is not set

Returns Descriptor