| 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 <!-- Adapted from http://jsbin.com/dexinu/6/edit for layout test --> | 4 <!-- Adapted from http://jsbin.com/dexinu/6/edit for layout test --> |
| 5 | 5 |
| 6 <template id="XMenuTemplate"> | 6 <template id="XMenuTemplate"> |
| 7 <style> | 7 <style> |
| 8 :host { | 8 :host { |
| 9 display: inline-block; | 9 display: inline-block; |
| 10 position: relative; | 10 position: relative; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 this.createShadowRoot({ 'delegatesFocus': delegatesFocus }) | 48 this.createShadowRoot({ 'delegatesFocus': delegatesFocus }) |
| 49 .appendChild( | 49 .appendChild( |
| 50 document.importNode(template.content, true) | 50 document.importNode(template.content, true) |
| 51 ); | 51 ); |
| 52 }; | 52 }; |
| 53 document.registerElement('x-menu', { | 53 document.registerElement('x-menu', { |
| 54 prototype: xMenuProto | 54 prototype: xMenuProto |
| 55 }); | 55 }); |
| 56 } | 56 } |
| 57 | 57 |
| 58 function backgroundColorOf(selector) { | |
| 59 return window.getComputedStyle(getNodeInTreeOfTrees(selector)).backgroundCol
or; | |
| 60 } | |
| 61 | |
| 62 function backgroundColorShouldBe(selector, expected) { | |
| 63 shouldBeEqualToString('backgroundColorOf(\'' + selector + '\')', expected); | |
| 64 } | |
| 65 | |
| 66 function test() { | 58 function test() { |
| 67 debug("crbug/474687 :focus style should properly be applied to shadow hosts.
"); | 59 debug("crbug/474687 :focus style should properly be applied to shadow hosts.
"); |
| 68 | 60 |
| 69 var xmenu1 = document.getElementById("XMenu1"); | 61 var xmenu1 = document.getElementById("XMenu1"); |
| 70 xmenu1.focus(); | 62 xmenu1.focus(); |
| 71 navigateFocusForward(); | 63 navigateFocusForward(); |
| 72 navigateFocusForward(); | 64 navigateFocusForward(); |
| 73 navigateFocusForward(); | 65 navigateFocusForward(); |
| 74 shouldBeEqualToString('document.activeElement.id', 'XMenu1'); | 66 shouldBeEqualToString('document.activeElement.id', 'XMenu1'); |
| 75 backgroundColorShouldBe('XMenu1', 'rgb(170, 170, 170)'); | 67 backgroundColorShouldBe('XMenu1', 'rgb(170, 170, 170)'); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 shouldBeEqualToString('document.activeElement.id', 'XMenu1'); | 120 shouldBeEqualToString('document.activeElement.id', 'XMenu1'); |
| 129 backgroundColorShouldBe('XMenu1', 'rgb(170, 170, 170)'); | 121 backgroundColorShouldBe('XMenu1', 'rgb(170, 170, 170)'); |
| 130 backgroundColorShouldBe('XMenu2', 'rgb(170, 170, 170)'); | 122 backgroundColorShouldBe('XMenu2', 'rgb(170, 170, 170)'); |
| 131 backgroundColorShouldBe('XMenu3', 'rgb(170, 170, 170)'); | 123 backgroundColorShouldBe('XMenu3', 'rgb(170, 170, 170)'); |
| 132 backgroundColorShouldBe('XMenu4', 'rgb(170, 170, 170)'); | 124 backgroundColorShouldBe('XMenu4', 'rgb(170, 170, 170)'); |
| 133 } | 125 } |
| 134 | 126 |
| 135 RegisterXMenu(); | 127 RegisterXMenu(); |
| 136 test(); | 128 test(); |
| 137 </script> | 129 </script> |
| OLD | NEW |