| 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 testDistributedNodes() { | 17 function testDistributedNodes() { |
| 26 debug('Testing shadow host :focus and distributed nodes'); | 18 debug('Testing shadow host :focus and distributed nodes'); |
| 27 | 19 |
| 28 // Setting up the DOM tree | 20 // Setting up the DOM tree |
| 29 var sandbox = document.querySelector('#sandbox'); | 21 var sandbox = document.querySelector('#sandbox'); |
| 30 sandbox.innerHTML = ''; | 22 sandbox.innerHTML = ''; |
| 31 sandbox.appendChild( | 23 sandbox.appendChild( |
| 32 createDOM('div', {}, | 24 createDOM('div', {}, |
| 33 createDOM('input', {'id': 'outer-input'}), | 25 createDOM('input', {'id': 'outer-input'}), |
| 34 createDOM('div', {'id': 'shadow-host', 'tabindex': '0'}, | 26 createDOM('div', {'id': 'shadow-host', 'tabindex': '0'}, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 olderInput.focus(); | 80 olderInput.focus(); |
| 89 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 81 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 90 youngerInput.focus(); | 82 youngerInput.focus(); |
| 91 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 83 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 92 host.focus(); | 84 host.focus(); |
| 93 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); | 85 backgroundColorShouldBe('shadow-host', 'rgb(0, 128, 0)'); |
| 94 } | 86 } |
| 95 | 87 |
| 96 testDistributedNodes(); | 88 testDistributedNodes(); |
| 97 </script> | 89 </script> |
| OLD | NEW |