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 <style> | 3 <style> |
4 div#host:focus { display: none; } | 4 div#host:focus { display: none; } |
5 </style> | 5 </style> |
6 <div id="sandbox"></div> | 6 <div id="sandbox"></div> |
7 <div id="host"></div> | 7 <div id="host"></div> |
8 <script> | 8 <script> |
9 description('Check if shadow host with display:none CSS rule for :focus works.
crbug.com/482830'); | 9 description('Check if shadow host with display:none CSS rule for :focus works.
crbug.com/482830'); |
10 | 10 |
11 var host; | 11 var host; |
12 var root; | 12 var root; |
13 var input; | 13 var input; |
14 | 14 |
15 function setupShadowDOM(delegatesFocus) { | 15 function setupShadowDOM(delegatesFocus) { |
16 sandbox.innerHTML = ''; | 16 sandbox.innerHTML = ''; |
17 host = sandbox.appendChild(document.createElement('div')); | 17 host = sandbox.appendChild(document.createElement('div')); |
18 host.id = 'host'; | 18 host.id = 'host'; |
19 | 19 |
20 root = host.createShadowRoot({ 'delegatesFocus': delegatesFocus }); | 20 root = host.attachShadow({ 'delegatesFocus': delegatesFocus }); |
21 input = document.createElement('input'); | 21 input = document.createElement('input'); |
22 root.appendChild(input); | 22 root.appendChild(input); |
23 | 23 |
24 host.tabIndex = 0; | 24 host.tabIndex = 0; |
25 } | 25 } |
26 | 26 |
27 function testFocusShadowHost() { | 27 function testFocusShadowHost() { |
28 debug('when shadow host itself is focused, it should match display:none, los
e focus then becomes display:block again.'); | 28 debug('when shadow host itself is focused, it should match display:none, los
e focus then becomes display:block again.'); |
29 setupShadowDOM(false); | 29 setupShadowDOM(false); |
30 return new Promise( | 30 return new Promise( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 input.addEventListener('blur', onBlur); | 65 input.addEventListener('blur', onBlur); |
66 }); | 66 }); |
67 } | 67 } |
68 | 68 |
69 if (window.testRunner) { | 69 if (window.testRunner) { |
70 testFocusShadowHost().then(testFocusInsideShadowRoot).then(function(){ testR
unner.notifyDone(); }); | 70 testFocusShadowHost().then(testFocusInsideShadowRoot).then(function(){ testR
unner.notifyDone(); }); |
71 testRunner.waitUntilDone(); | 71 testRunner.waitUntilDone(); |
72 } | 72 } |
73 </script> | 73 </script> |
OLD | NEW |