OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 <script src="resources/shadow-dom.js"></script> | 3 <script src="resources/shadow-dom.js"></script> |
4 <style> | 4 <style> |
5 div { | 5 div { |
6 background-color: white; | 6 background-color: white; |
7 } | 7 } |
8 | 8 |
9 div#shadow-host:focus { | 9 div#shadow-host:focus { |
10 background-color: green; | 10 background-color: green; |
11 } | 11 } |
12 </style> | 12 </style> |
13 <body> | 13 <body> |
14 <div id="sandbox"></div> | 14 <div id="sandbox"></div> |
15 </body> | 15 </body> |
16 <script> | 16 <script> |
17 function backgroundColorOf(selector) { | |
18 return window.getComputedStyle(getNodeInTreeOfTrees(selector)).backgroundCol
or; | |
19 } | |
20 | |
21 function backgroundColorShouldBe(selector, expected) { | |
22 shouldBeEqualToString('backgroundColorOf(\'' + selector + '\')', expected); | |
23 } | |
24 | |
25 function buildNestedDistributionTree(delegatesFocus1, delegatesFocus2) { | 17 function buildNestedDistributionTree(delegatesFocus1, delegatesFocus2) { |
26 var sandbox = document.querySelector('#sandbox'); | 18 var sandbox = document.querySelector('#sandbox'); |
27 sandbox.innerHTML = ''; | 19 sandbox.innerHTML = ''; |
28 sandbox.appendChild( | 20 sandbox.appendChild( |
29 createDOM('div', {}, | 21 createDOM('div', {}, |
30 createDOM('input', {'id': 'outer-input'}), | 22 createDOM('input', {'id': 'outer-input'}), |
31 createDOM('div', {'id': 'shadow-host'}, | 23 createDOM('div', {'id': 'shadow-host'}, |
32 createDOM('input', {'id': 'input1'}), | 24 createDOM('input', {'id': 'input1'}), |
33 createShadowRoot( | 25 createShadowRoot( |
34 {'delegatesFocus': delegatesFocus1}, | 26 {'delegatesFocus': delegatesFocus1}, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 136 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
145 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(255, 255, 0)')
; | 137 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(255, 255, 0)')
; |
146 | 138 |
147 input3.focus(); | 139 input3.focus(); |
148 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 140 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
149 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(0, 0, 255)'); | 141 backgroundColorShouldBe('shadow-host/inner-shadow-host', 'rgb(0, 0, 255)'); |
150 } | 142 } |
151 | 143 |
152 testNestedDistribution(); | 144 testNestedDistribution(); |
153 </script> | 145 </script> |
OLD | NEW |