OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <script src="resources/shadow-dom.js"></script> | |
5 <script src="../../../resources/js-test.js"></script> | |
6 </head> | |
7 <body class="bodyClass"> | |
8 <div id="sandbox"></div> | |
9 <pre id="console"></pre> | |
10 </body> | |
11 <script> | |
12 description("Test for ::content with /deep/ and :host."); | |
13 | |
14 var sandbox = document.getElementById('sandbox'); | |
15 | |
16 function cleanUp() | |
17 { | |
18 sandbox.innerHTML = ''; | |
19 } | |
20 | |
21 sandbox.appendChild( | |
22 createDOM('div', {'id': 'host1'}, | |
23 createShadowRoot( | |
24 createDOM('style', {}, | |
25 document.createTextNode( | |
26 ':host(#host1) /deep/ #content1::content > .content { color:
green; }')), | |
27 createDOM('div', {}, | |
28 createDOM('div', {'id': 'host2'}, | |
29 createShadowRoot( | |
30 createDOM('content', {'id': 'content2'})), | |
31 createDOM('div', {'id': 'parentOfContent1'}, | |
32 createDOM('content', {'id': 'content1'}))))), | |
33 createDOM('div', {'class': 'content'}, | |
34 document.createTextNode('content')))); | |
35 | |
36 shouldBe('window.getComputedStyle(document.querySelector("#host1 > .content")).c
olor', '"rgb(0, 128, 0)"'); | |
37 | |
38 cleanUp(); | |
39 | |
40 sandbox.appendChild( | |
41 createDOM('div', {'id': 'host1'}, | |
42 createShadowRoot( | |
43 createDOM('style', {}, | |
44 document.createTextNode( | |
45 '#host2 /deep/ #content2::content > #parentOfContent1 > #con
tent1::content > .content { color: green; }')), | |
46 createDOM('div', {}, | |
47 createDOM('div', {'id': 'host2'}, | |
48 createShadowRoot( | |
49 createDOM('content', {'id': 'content2'})), | |
50 createDOM('div', {'id': 'parentOfContent1'}, | |
51 createDOM('content', {'id': 'content1'}))))), | |
52 createDOM('div', {'class': 'content'}, | |
53 document.createTextNode('content')))); | |
54 | |
55 shouldBe('window.getComputedStyle(document.querySelector("#host1 > .content")).c
olor', '"rgb(0, 128, 0)"'); | |
56 | |
57 cleanUp(); | |
58 | |
59 sandbox.appendChild( | |
60 createDOM('div', {'id': 'host1'}, | |
61 createShadowRoot( | |
62 createDOM('style', {}, | |
63 document.createTextNode( | |
64 ':host /deep/ #content2::content > #parentOfShadow1 > #shado
w1::content > .content { color: green; }' + | |
65 ':host /deep/ #content2::content > #shadow1::content > #cont
ent1::content > .content { color: red; }')), | |
66 createDOM('content', {'id': 'content1'})), | |
67 createShadowRoot( | |
68 createDOM('div', {}, | |
69 createDOM('div', {'id': 'host2'}, | |
70 createShadowRoot( | |
71 createDOM('content', {'id': 'content2'})), | |
72 createDOM('div', {'id': 'parentOfShadow1'}, | |
73 createDOM('shadow', {'id': 'shadow1'}))))), | |
74 createDOM('div', {'class': 'content'}, | |
75 document.createTextNode('content')))); | |
76 | |
77 shouldBe('window.getComputedStyle(document.querySelector("#host1 > .content")).c
olor', '"rgb(0, 128, 0)"'); | |
78 | |
79 cleanUp(); | |
80 | |
81 sandbox.appendChild( | |
82 createDOM('div', {'id': 'host1'}, | |
83 createShadowRoot( | |
84 createDOM('style', {}, | |
85 document.createTextNode( | |
86 ':host /deep/ :host > #content2::content > #shadow1::content
> #content1::content > .content { color: red; }')), | |
87 createDOM('content', {'id': 'content1'})), | |
88 createShadowRoot( | |
89 createDOM('div', {}, | |
90 createDOM('div', {'id': 'host2'}, | |
91 createShadowRoot( | |
92 createDOM('content', {'id': 'content2'})), | |
93 createDOM('div', {'id': 'parentOfShadow1'}, | |
94 createDOM('shadow', {'id': 'shadow1'}))))), | |
95 createDOM('div', {'class': 'content'}, | |
96 document.createTextNode('content')))); | |
97 | |
98 shouldNotBe('window.getComputedStyle(document.querySelector("#host1 > .content")
).color', '"rgb(255, 0, 0)"'); | |
99 | |
100 cleanUp(); | |
101 | |
102 sandbox.appendChild( | |
103 createDOM('div', {'id': 'host1'}, | |
104 createShadowRoot( | |
105 createDOM('style', {}, | |
106 document.createTextNode( | |
107 ':host /deep/ #content2::content > #parentOfContent1 > #cont
ent1::content > .content { color: green; }')), | |
108 createDOM('div', {}, | |
109 createDOM('div', {'id': 'host2'}, | |
110 createShadowRoot( | |
111 createDOM('content', {'id': 'content2'})), | |
112 createDOM('div', {'id': 'parentOfContent1'}, | |
113 createDOM('content', {'id': 'content1'}))))), | |
114 createDOM('div', {'class': 'content'}, | |
115 document.createTextNode('content')))); | |
116 | |
117 shouldBe('window.getComputedStyle(document.querySelector("#host1 > .content")).c
olor', '"rgb(0, 128, 0)"'); | |
118 | |
119 cleanUp(); | |
120 | |
121 </script> | |
122 </html> | |
OLD | NEW |