| 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; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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'); |
| 38 var lightdomInput = document.querySelector('#lightdom-input'); | 38 var lightdomInput = document.querySelector('#lightdom-input'); |
| 39 var innerInput = getNodeInTreeOfTrees('shadow-host/inner-input'); | 39 var innerInput = getNodeInComposedTree('shadow-host/inner-input'); |
| 40 var outerInput = document.querySelector('#outer-input'); | 40 var outerInput = document.querySelector('#outer-input'); |
| 41 | 41 |
| 42 outerInput.focus(); | 42 outerInput.focus(); |
| 43 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 43 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| 44 lightdomInput.focus(); | 44 lightdomInput.focus(); |
| 45 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 45 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| 46 innerInput.focus(); | 46 innerInput.focus(); |
| 47 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 47 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| 48 host.focus(); // host will not get focus as it is not focusable. | 48 host.focus(); // host will not get focus as it is not focusable. |
| 49 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 49 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 69 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| 70 host.focus(); | 70 host.focus(); |
| 71 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 71 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 72 | 72 |
| 73 | 73 |
| 74 debug('(4/6) Testing how :focus matches on shadow host with delegatesFocus=t
rue.'); | 74 debug('(4/6) Testing how :focus matches on shadow host with delegatesFocus=t
rue.'); |
| 75 buildSingleShadowTree(true); | 75 buildSingleShadowTree(true); |
| 76 | 76 |
| 77 var host = document.querySelector('#shadow-host'); | 77 var host = document.querySelector('#shadow-host'); |
| 78 var lightdomInput = document.querySelector('#lightdom-input'); | 78 var lightdomInput = document.querySelector('#lightdom-input'); |
| 79 var innerInput = getNodeInTreeOfTrees('shadow-host/inner-input'); | 79 var innerInput = getNodeInComposedTree('shadow-host/inner-input'); |
| 80 var outerInput = document.querySelector('#outer-input'); | 80 var outerInput = document.querySelector('#outer-input'); |
| 81 | 81 |
| 82 outerInput.focus(); | 82 outerInput.focus(); |
| 83 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 83 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| 84 lightdomInput.focus(); | 84 lightdomInput.focus(); |
| 85 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); | 85 backgroundColorShouldBe('shadow-host', 'rgb(255, 255, 255)'); |
| 86 innerInput.focus(); | 86 innerInput.focus(); |
| 87 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 87 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 88 host.focus(); | 88 host.focus(); |
| 89 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 89 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| (...skipping 16 matching lines...) Expand all 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 |