| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="resources/shadow-dom.js"></script> | 4 <script src="resources/shadow-dom.js"></script> |
| 5 <script src="../../../resources/js-test.js"></script> | 5 <script src="../../../resources/js-test.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <div id='sandbox'></div> | 8 <div id='sandbox'></div> |
| 9 <pre id='console'></pre> | 9 <pre id='console'></pre> |
| 10 </body> | 10 </body> |
| 11 <script> | 11 <script> |
| 12 function backgroundColorOf(node) | |
| 13 { | |
| 14 return document.defaultView.getComputedStyle(node, null).getPropertyValue('b
ackground-color'); | |
| 15 } | |
| 16 | |
| 17 function backgroundColorShouldBe(selector, color) | |
| 18 { | |
| 19 var text = 'backgroundColorOf(getNodeInTreeOfTrees("' + selector + '"))'; | |
| 20 shouldBeEqualToString(text, color); | |
| 21 } | |
| 22 | |
| 23 function backgroundColorShouldNotBe(selector, color) | |
| 24 { | |
| 25 var text = 'backgroundColorOf(getNodeInTreeOfTrees("' + selector + '"))'; | |
| 26 var unevaledString = '"' + color.replace(/\\/g, "\\\\").replace(/"/g, "\"")
+ '"'; | |
| 27 shouldNotBe(text, unevaledString); | |
| 28 } | |
| 29 | |
| 30 function cleanUp() | 12 function cleanUp() |
| 31 { | 13 { |
| 32 document.getElementById('sandbox').innerHTML = ''; | 14 document.getElementById('sandbox').innerHTML = ''; |
| 33 } | 15 } |
| 34 | 16 |
| 35 description('Test for http://crbug.com/35340: Style should not be conditioned by
the presence of the shadow element.'); | 17 description('Test for http://crbug.com/35340: Style should not be conditioned by
the presence of the shadow element.'); |
| 36 | 18 |
| 37 var sandbox = document.getElementById('sandbox'); | 19 var sandbox = document.getElementById('sandbox'); |
| 38 | 20 |
| 39 sandbox.appendChild( | 21 sandbox.appendChild( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 document.createTextNode(':host { display: block; background: gre
en; }'))), | 70 document.createTextNode(':host { display: block; background: gre
en; }'))), |
| 89 createShadowRoot( | 71 createShadowRoot( |
| 90 createDOM('div', {'id': 'target'}, | 72 createDOM('div', {'id': 'target'}, |
| 91 document.createTextNode('younger div should be green'))))); | 73 document.createTextNode('younger div should be green'))))); |
| 92 | 74 |
| 93 backgroundColorShouldBe('host', 'rgb(0, 128, 0)'); | 75 backgroundColorShouldBe('host', 'rgb(0, 128, 0)'); |
| 94 | 76 |
| 95 cleanUp(); | 77 cleanUp(); |
| 96 </script> | 78 </script> |
| 97 </html> | 79 </html> |
| 98 | |
| OLD | NEW |