Comparing version 1.12.0 to 1.12.1
@@ -353,3 +353,4 @@ (function(chaiDom) { | ||
var el = flag(this, 'object'), | ||
actual = el.getRootNode({ composed: true }) === document ? window.getComputedStyle(el).display : el.style.display | ||
isAttached = el.getRootNode ? el.getRootNode({ composed: true }) === document : document.body.contains(el), | ||
actual = isAttached ? window.getComputedStyle(el).display : el.style.display | ||
@@ -366,3 +367,4 @@ this.assert( | ||
var el = flag(this, 'object'), | ||
actual = document.body.contains(el) ? window.getComputedStyle(el).visibility : el.style.visibility | ||
isAttached = el.getRootNode ? el.getRootNode({ composed: true }) === document : document.body.contains(el), | ||
actual = isAttached ? window.getComputedStyle(el).visibility : el.style.visibility | ||
@@ -369,0 +371,0 @@ this.assert( |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "1.12.0", | ||
"version": "1.12.1", | ||
"license": "MIT", | ||
@@ -19,0 +19,0 @@ "repository": { |
@@ -35,2 +35,14 @@ describe('DOM assertions', function() { | ||
class CustomElement extends HTMLElement { | ||
constructor() { | ||
super() | ||
this.attachShadow({ mode: 'open' }) | ||
var template = document.createElement('template') | ||
template.innerHTML = '<style>div { display: none; visibility: hidden; }</style>' | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)) | ||
this.shadowRoot.appendChild(document.createElement('div')) | ||
} | ||
} | ||
window.customElements.define('custom-element', CustomElement) | ||
describe('attr', function() { | ||
@@ -841,10 +853,2 @@ beforeEach(function() { | ||
describe('displayed', function() { | ||
class CustomElement extends HTMLElement { | ||
constructor() { | ||
super() | ||
this.attachShadow({ mode: 'open' }) | ||
this.shadowRoot.appendChild(document.createElement('div')) | ||
} | ||
} | ||
var ce = document.createElement('custom-element'), | ||
@@ -857,4 +861,2 @@ div = document.createElement('div'), | ||
before(function() { | ||
window.customElements.define('custom-element', CustomElement) | ||
document.styleSheets[1].insertRule('.hidden { display: none; }', 0); | ||
@@ -905,4 +907,4 @@ document.body.appendChild(notDisplayedViaCSS) | ||
it('passes when the element is in the shadow DOM', function() { | ||
ce.shadowRoot.querySelector('div').should.be.displayed | ||
it('passes negated when the element is in the shadow DOM', function() { | ||
ce.shadowRoot.querySelector('div').should.not.be.displayed | ||
}) | ||
@@ -912,3 +914,4 @@ }) | ||
describe('visible', function() { | ||
var div = document.createElement('div'), | ||
var ce = document.createElement('custom-element'), | ||
div = document.createElement('div'), | ||
hiddenViaStyle = parse('<div style="visibility: hidden"></div>'), | ||
@@ -925,2 +928,3 @@ collapsedViaStyle = parse('<div style="visibility: collapse"></div>'), | ||
document.body.appendChild(div) | ||
document.body.appendChild(ce) | ||
}) | ||
@@ -931,2 +935,3 @@ after(function() { | ||
document.body.removeChild(div) | ||
document.body.removeChild(ce) | ||
}) | ||
@@ -974,2 +979,6 @@ | ||
}) | ||
it('passes negated when the element is in the shadow DOM', function() { | ||
ce.shadowRoot.querySelector('div').should.not.be.visible | ||
}) | ||
}) | ||
@@ -976,0 +985,0 @@ |
67961
1362