Has class
Methods
Table of Contents
hasClass
Validates if an element or a set of elements have a given CSS class.
Parameters
cssClass
string CSS class to be validatedselector
string CSS selector of the element to checkuserOptions
(optional, default{}
)-
options
Object Additional options
Examples
// <em class="lorem"></em><span class="success">Message!</span>
import { create, hasClass } from 'ember-cli-page-object';
const page = create({
messageIsSuccess: hasClass('success', 'span')
});
assert.ok(page.messageIsSuccess);
// <div>
// <span class="lorem"></span>
// </div>
// <div class="scope">
// <span class="ipsum"></span>
// </div>
import { create, hasClass } from 'ember-cli-page-object';
const page = create({
spanHasClass: hasClass('ipsum', 'span', { scope: '.scope' })
});
assert.ok(page.spanHasClass);
// <div>
// <span class="lorem"></span>
// </div>
// <div class="scope">
// <span class="ipsum"></span>
// </div>
import { create, hasClass } from 'ember-cli-page-object';
const page = create({
scope: '.scope',
spanHasClass: hasClass('ipsum', 'span')
});
assert.ok(page.spanHasClass);
- 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