Count
Methods
Table of Contents
count
Parameters
selector
string CSS selector of the element or elements to checkuserOptions
(optional, default{}
)-
options
Object Additional options
Examples
// <span>1</span>
// <span>2</span>
import { create, count } from 'ember-cli-page-object';
const page = create({
spanCount: count('span')
});
assert.equal(page.spanCount, 2);
// <div>Text</div>
import { create, count } from 'ember-cli-page-object';
const page = create({
spanCount: count('span')
});
assert.equal(page.spanCount, 0);
// <div><span></span></div>
// <div class="scope"><span></span><span></span></div>
import { create, count } from 'ember-cli-page-object';
const page = create({
spanCount: count('span', { scope: '.scope' })
});
assert.equal(page.spanCount, 2)
// <div><span></span></div>
// <div class="scope"><span></span><span></span></div>
import { create, count } from 'ember-cli-page-object';
const page = create({
scope: '.scope',
spanCount: count('span')
});
assert.equal(page.spanCount, 2)
// <div><span></span></div>
// <div class="scope"><span></span><span></span></div>
import { create, count } from 'ember-cli-page-object';
const page = create({
scope: '.scope',
spanCount: count('span', { resetScope: true })
});
assert.equal(page.spanCount, 1);
Returns Descriptor