Contains
Methods
Table of Contents
contains
Returns a boolean representing whether an element or a set of elements contains the specified text.
Parameters
selector
string CSS selector of the element to checkuserOptions
(optional, default{}
)-
options
Object Additional options
Examples
// Lorem <span>ipsum</span>
import { create, contains } from 'ember-cli-page-object';
const page = create({
spanContains: contains('span')
});
assert.ok(page.spanContains('ipsum'));
// <div><span>lorem</span></div>
// <div class="scope"><span>ipsum</span></div>
// <div><span>dolor</span></div>
import { create, contains } from 'ember-cli-page-object';
const page = create({
spanContains: contains('span', { scope: '.scope' })
});
assert.notOk(page.spanContains('lorem'));
assert.ok(page.spanContains('ipsum'));
// <div><span>lorem</span></div>
// <div class="scope"><span>ipsum</span></div>
// <div><span>dolor</span></div>
import { create, contains } from 'ember-cli-page-object';
const page = create({
scope: '.scope',
spanContains: contains('span')
});
assert.notOk(page.spanContains('lorem'));
assert.ok(page.spanContains('ipsum'));
- Throws any Will throw an error if no element matches selector
- Throws any Will throw an error if multiple elements are matched by selector
Returns Descriptor