Chromium Code Reviews| Index: LayoutTests/fast/dom/shadow/closed-mode-deep-combinator-and-shadow-pseudo.html |
| diff --git a/LayoutTests/fast/dom/shadow/closed-mode-deep-combinator-and-shadow-pseudo.html b/LayoutTests/fast/dom/shadow/closed-mode-deep-combinator-and-shadow-pseudo.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..45e2f1146cbde6e336031efc72d7a407c9a428a9 |
| --- /dev/null |
| +++ b/LayoutTests/fast/dom/shadow/closed-mode-deep-combinator-and-shadow-pseudo.html |
| @@ -0,0 +1,141 @@ |
| +<!doctype html> |
| +<script src="../../../resources/js-test.js"></script> |
| +<script src="resources/shadow-dom.js"></script> |
| +<style id="style1"> |
| +</style> |
| +<body></body> |
| +<script> |
| +function prepareShadowTree(hostId, mode1, mode2, div1, div2, div3) { |
| + var parent = document.body; |
| + parent.appendChild( |
| + createDOM('div', {'id': hostId}, |
| + createShadowRoot({'mode': mode1}, |
| + createDOM('div', {'id': div1}, |
| + createShadowRoot({'mode': mode2}, |
| + createDOM('div', {'id': div2})), |
| + createDOM('div', {'id': div3}))))); |
| +} |
| + |
| +prepareShadowTree('host_open_open', 'open', 'open', 'div1', 'div2', 'div1b'); |
| +prepareShadowTree('host_open_closed', 'open', 'closed', 'div3', 'div4', 'div3b'); |
| +prepareShadowTree('host_closed_open', 'closed', 'open', 'div5', 'div6', 'div5b'); |
| +prepareShadowTree('host_closed_closed', 'closed', 'closed', 'div7', 'div8', 'div7b'); |
| + |
| +debug('(1/6) /deep/ style rule on top-level document.'); |
| +var styleElement = document.getElementById('style1'); |
| +styleElement.textContent = 'div /deep/ div { background-color: blue; }'; |
| + |
| +backgroundColorShouldBe('host_open_open', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_open_open/div1/div2', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_open_open/div1b', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_open_closed', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_open_closed/div3/div4', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3b', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_closed_open', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5/div6', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5b', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7/div8', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7b', 'rgba(0, 0, 0, 0)'); |
| + |
| +debug('(2/6) ::shadow style rule on top-level document.'); |
| +styleElement.innerHTML = 'div::shadow div { background-color: green; }'; |
| + |
| +backgroundColorShouldBe('host_open_open', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1', 'rgb(0, 128, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1/div2', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1b', 'rgb(0, 128, 0)'); |
| +backgroundColorShouldBe('host_open_closed', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3', 'rgb(0, 128, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3/div4', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3b', 'rgb(0, 128, 0)'); |
| +backgroundColorShouldBe('host_closed_open', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5/div6', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5b', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7/div8', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7b', 'rgba(0, 0, 0, 0)'); |
| + |
| +debug('(3/6) /deep/ style on shadow tree.'); |
| +styleElement.innerHTML = ''; |
| +var div1 = getNodeInTreeOfTrees('host_open_open/div1'); |
| +div1.insertAdjacentHTML('afterbegin', '<style>div /deep/ div { background-color: blue; }</style>'); |
| +backgroundColorShouldBe('host_open_open/div1', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1/div2', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_open_open/div1b', 'rgb(0, 0, 255)'); |
| +div1.removeChild(div1.firstElementChild); |
| + |
| +var div3 = getNodeInTreeOfTrees('host_open_closed/div3'); |
| +div3.insertAdjacentHTML('afterbegin', '<style>div /deep/ div { background-color: blue; }</style>'); |
| +backgroundColorShouldBe('host_open_closed/div3', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3/div4', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3b', 'rgb(0, 0, 255)'); |
| +div3.removeChild(div3.firstElementChild); |
| + |
| +var div5 = getNodeInTreeOfTrees('host_closed_open/div5'); |
| +div5.insertAdjacentHTML('afterbegin', '<style>div /deep/ div { background-color: blue; }</style>'); |
| +backgroundColorShouldBe('host_closed_open/div5', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5/div6', 'rgb(0, 0, 255)'); |
| +backgroundColorShouldBe('host_closed_open/div5b', 'rgb(0, 0, 255)'); |
| +div5.removeChild(div5.firstElementChild); |
| + |
| +var div7 = getNodeInTreeOfTrees('host_closed_closed/div7'); |
| +div7.insertAdjacentHTML('afterbegin', '<style>div /deep/ div { background-color: blue; }</style>'); |
| +backgroundColorShouldBe('host_closed_closed/div7', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7/div8', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7b', 'rgb(0, 0, 255)'); |
| +div7.removeChild(div7.firstElementChild); |
| + |
| +debug('(4/6) ::shadow style on shadow tree.'); |
| +div1.insertAdjacentHTML('afterbegin', '<style>div::shadow div { background-color: green; }</style>'); |
| +backgroundColorShouldBe('host_open_open/div1', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1/div2', 'rgb(0, 128, 0)'); |
| +backgroundColorShouldBe('host_open_open/div1b', 'rgba(0, 0, 0, 0)'); |
| +div1.removeChild(div1.firstElementChild); |
| + |
| +div3.insertAdjacentHTML('afterbegin', '<style>div::shadow div { background-color: green; }</style>'); |
| +backgroundColorShouldBe('host_open_closed/div3', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3/div4', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_open_closed/div3b', 'rgba(0, 0, 0, 0)'); |
| +div3.removeChild(div3.firstElementChild); |
| + |
| +div5.insertAdjacentHTML('afterbegin', '<style>div::shadow div { background-color: green; }</style>'); |
| +backgroundColorShouldBe('host_closed_open/div5', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5/div6', 'rgb(0, 128, 0)'); |
| +backgroundColorShouldBe('host_closed_open/div5b', 'rgba(0, 0, 0, 0)'); |
| +div5.removeChild(div5.firstElementChild); |
| + |
| +div7.insertAdjacentHTML('afterbegin', '<style>div::shadow div { background-color: green; }</style>'); |
| +backgroundColorShouldBe('host_closed_closed/div7', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7/div8', 'rgba(0, 0, 0, 0)'); |
| +backgroundColorShouldBe('host_closed_closed/div7b', 'rgba(0, 0, 0, 0)'); |
| +div7.removeChild(div7.firstElementChild); |
| + |
| +debug('(5/6) /deep/ selector in querySelectorAll()'); |
| +shouldBe('host_open_open.querySelectorAll("div /deep/ div").length', '3'); |
|
hayato
2015/08/20 03:47:11
Could you assert the content of the result of quer
kochi
2015/08/20 06:04:26
Done.
|
| +shouldBe('host_open_closed.querySelectorAll("div /deep/ div").length', '2'); |
| +shouldBe('host_closed_open.querySelectorAll("div /deep/ div").length', '0'); |
| +shouldBe('host_closed_closed.querySelectorAll("div /deep/ div").length', '0'); |
| + |
| +shouldBe('div1.querySelectorAll("div /deep/ div").length', '2'); |
| +shouldBe('div3.querySelectorAll("div /deep/ div").length', '1'); |
| +shouldBe('div5.querySelectorAll("div /deep/ div").length', '2'); |
| +shouldBe('div7.querySelectorAll("div /deep/ div").length', '1'); |
| + |
| +debug('(6/6) ::shadow selector in querySelectorAll()'); |
| +shouldBe('host_open_open.querySelectorAll("div::shadow div").length', '2'); |
| +shouldBe('host_open_closed.querySelectorAll("div::shadow div").length', '2'); |
| +shouldBe('host_closed_open.querySelectorAll("div::shadow div").length', '0'); |
| +shouldBe('host_closed_closed.querySelectorAll("div::shadow div").length', '0'); |
| + |
| +shouldBe('div1.querySelectorAll("div::shadow div").length', '1'); |
| +shouldBe('div3.querySelectorAll("div::shadow div").length', '0'); |
| +shouldBe('div5.querySelectorAll("div::shadow div").length', '1'); |
| +shouldBe('div7.querySelectorAll("div::shadow div").length', '0'); |
| +</script> |