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="../fast/dom/shadow/resources/shadow-dom.js"></script> | 3 <script src="../fast/dom/shadow/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 buildSingleShadowTree(delegatesFocus) { | 17 function buildSingleShadowTree(delegatesFocus) { |
18 var sandbox = document.querySelector('#sandbox'); | 18 var sandbox = document.querySelector('#sandbox'); |
19 sandbox.innerHTML = ''; | 19 sandbox.innerHTML = ''; |
20 sandbox.appendChild( | 20 sandbox.appendChild( |
21 createDOM('div', {}, | 21 createDOM('div', {}, |
22 createDOM('input', {'id': 'outer-input'}), | 22 createDOM('input', {'id': 'outer-input'}), |
23 createDOM('div', {'id': 'shadow-host'}, | 23 createDOM('div', {'id': 'shadow-host'}, |
24 createDOM('input', {'id': 'lightdom-input'}), | 24 createDOM('input', {'id': 'lightdom-input'}), |
25 attachShadow( | 25 attachShadow( |
26 {'mode': 'open', 'delegatesFocus': delegatesFocus}, | 26 {'mode': 'open', 'delegatesFocus': delegatesFocus}, |
27 createDOM('slot'), | 27 createDOM('slot'), |
28 createDOM('input', {'id': 'inner-input'}))))); | 28 createDOM('input', {'id': 'inner-input'}))))); |
29 | 29 |
30 sandbox.offsetTop; | |
31 } | 30 } |
32 | 31 |
33 function testSingleShadow() { | 32 function testSingleShadow() { |
34 debug('(1/6) Testing how :focus matches on shadow host with delegatesFocus=f
alse.'); | 33 debug('(1/6) Testing how :focus matches on shadow host with delegatesFocus=f
alse.'); |
35 buildSingleShadowTree(false); | 34 buildSingleShadowTree(false); |
36 | 35 |
37 var host = document.querySelector('#shadow-host'); | 36 var host = document.querySelector('#shadow-host'); |
38 var lightdomInput = document.querySelector('#lightdom-input'); | 37 var lightdomInput = document.querySelector('#lightdom-input'); |
39 var innerInput = getNodeInComposedTree('shadow-host/inner-input'); | 38 var innerInput = getNodeInComposedTree('shadow-host/inner-input'); |
40 var outerInput = document.querySelector('#outer-input'); | 39 var outerInput = document.querySelector('#outer-input'); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 lightdomInput.focus(); | 105 lightdomInput.focus(); |
107 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 106 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
108 innerInput.focus(); | 107 innerInput.focus(); |
109 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 108 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
110 host.focus(); | 109 host.focus(); |
111 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 110 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
112 } | 111 } |
113 | 112 |
114 testSingleShadow(); | 113 testSingleShadow(); |
115 </script> | 114 </script> |
OLD | NEW |