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 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 createShadowRoot( | 25 attachShadow( |
26 {'delegatesFocus': delegatesFocus}, | 26 {'mode': 'open', 'delegatesFocus': delegatesFocus}, |
27 createDOM('content'), | 27 createDOM('slot'), |
28 createDOM('input', {'id': 'inner-input'}))))); | 28 createDOM('input', {'id': 'inner-input'}))))); |
29 | 29 |
30 sandbox.offsetTop; | 30 sandbox.offsetTop; |
31 } | 31 } |
32 | 32 |
33 function testSingleShadow() { | 33 function testSingleShadow() { |
34 debug('(1/6) Testing how :focus matches on shadow host with delegatesFocus=f
alse.'); | 34 debug('(1/6) Testing how :focus matches on shadow host with delegatesFocus=f
alse.'); |
35 buildSingleShadowTree(false); | 35 buildSingleShadowTree(false); |
36 | 36 |
37 var host = document.querySelector('#shadow-host'); | 37 var host = document.querySelector('#shadow-host'); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 lightdomInput.focus(); | 106 lightdomInput.focus(); |
107 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 107 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
108 innerInput.focus(); | 108 innerInput.focus(); |
109 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 109 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
110 host.focus(); | 110 host.focus(); |
111 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 111 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
112 } | 112 } |
113 | 113 |
114 testSingleShadow(); | 114 testSingleShadow(); |
115 </script> | 115 </script> |
OLD | NEW |