Is hidden
Methods
isHidden
addon/-private/properties/is-hidden.js:90-107
Validates if an element or set of elements are hidden or exist in the DOM.
Parameters
selector
string CSS selector of the element to checkoptions
Object Additional optionsoptions.scope
string Nests provided scope within parent’s scopeoptions.at
number Reduce the set of matched elements to the one at the specified indexoptions.resetScope
boolean Override parent’s scopeoptions.multiple
boolean Check if all elements matched by selector are hiddenoptions.testContainer
String Context where to search elements in the DOM
Examples
// Lorem <span style="display:none">ipsum</span>
const page = PageObject.create({
spanIsHidden: PageObject.isHidden('span')
});
assert.ok(page.spanIsHidden);
// <span>ipsum</span>
// <span style="display:none">dolor</span>
const page = create({
spansAreHidden: PageObject.isHidden('span', { multiple: true })
});
// not all spans are hidden
assert.notOk(page.spansAreHidden);
// <span style="display:none">dolor</span>
// <span style="display:none">dolor</span>
const page = create({
spansAreHidden: PageObject.isHidden('span', { multiple: true })
});
// all spans are hidden
assert.ok(page.spansAreHidden);
// Lorem <strong>ipsum</strong>
const page = PageObject.create({
spanIsHidden: PageObject.isHidden('span')
});
// returns true when element doesn't exist in DOM
assert.ok(page.spanIsHidden);
// <div><span>lorem</span></div>
// <div class="scope"><span style="display:none">ipsum</span></div>
// <div><span>dolor</span></div>
const page = PageObject.create({
scopedSpanIsHidden: PageObject.isHidden('span', { scope: '.scope' })
});
assert.ok(page.scopedSpanIsHidden);
// <div><span>lorem</span></div>
// <div class="scope"><span style="display:none">ipsum</span></div>
// <div><span>dolor</span></div>
const page = PageObject.create({
scope: '.scope',
scopedSpanIsHidden: PageObject.isHidden('span')
});
assert.ok(page.scopedSpanIsHidden);
Returns Descriptor