Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <body> | |
| 5 <div id="host"></div> | |
| 6 <div id="bodyChild"></div> | |
| 7 </body> | |
| 8 <script> | |
| 9 function colorFor(elem) { | |
| 10 return document.defaultView.getComputedStyle(elem, '').color; | |
| 11 } | |
| 12 | |
| 13 async_test((test) => { | |
| 14 let link = document.createElement('link'); | |
| 15 link.setAttribute('rel', 'stylesheet'); | |
| 16 link.setAttribute('href', 'data:text/css,div { color: green }'); | |
| 17 link.addEventListener("load", (e) => { | |
| 18 test.step(() => { | |
|
kochi
2016/07/29 07:10:12
nit: instead of "(e) => { test.step(() => {... tes
hayato
2016/07/29 07:41:56
Done
| |
| 19 assert_equals(colorFor(bodyChild), 'rgb(0, 0, 0)', 'An element in a docume nt tree should not be styled.'); | |
| 20 assert_equals(colorFor(shadowChild), 'rgb(0, 128, 0)', 'An element in a sh adow tree should be styled.'); | |
| 21 test.done(); | |
| 22 }); | |
| 23 }); | |
| 24 let sr = host.attachShadow({ mode: 'open' }); | |
| 25 let shadowChild = document.createElement('div'); | |
| 26 sr.appendChild(shadowChild); | |
| 27 sr.appendChild(link); | |
| 28 }, '<link rel=stylesheet> should load a stylesheet in a connected shadow tree.') ; | |
| 29 </script> | |
| OLD | NEW |