Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../../resources/testharness.js"></script> | |
| 3 <script src="../../../resources/testharnessreport.js"></script> | |
| 4 <style> | |
| 5 .target { | |
| 6 background-color:blue; | |
| 7 color:white; | |
| 8 width:100px; height:40px; | |
| 9 margin:10px; | |
| 10 } | |
| 11 </style> | |
| 12 <div id="container"> | |
| 13 <p>To test manually, hover over blue boxes and see if the tooltip says "PASS "</p> | |
| 14 <div id="normal" title="PASS"></div> | |
| 15 <div id="distributed" title="PASS"><div class="target">Distributed</div></di v> | |
| 16 <div id="multiple" title="PASS"><div class="target">Distributed to the young est</div></div> | |
| 17 <div id="multilevel" title="PASS"><div class="target">Multi-level Distribute d</div></div> | |
| 18 <div id="older" title="PASS"></div> | |
| 19 <div id="redistributed" title="PASS"><div class="target">Redistributed</div> </div> | |
| 20 </div> | |
| 21 <script> | |
| 22 setup({ explicit_done: true }); | |
| 23 var style = "<style>.target { background-color:blue; color:white; width:100px; h eight:40px; margin:10px; }</style>"; | |
| 24 | |
| 25 if (!window.eventSender || !window.testRunner) | |
| 26 test(function () { assert_unreached(); }, "Cannot automate the tests without eventSender and testRunner"); | |
| 27 | |
| 28 var host = document.getElementById("normal"); | |
| 29 var root = createShadowRootWithInnerHtml(host, style + "<div class=target>Shadow </div>"); | |
| 30 testTooltipTextInShadow("The title of elements in shadow inherits from the docum ent", root.querySelector("div")); | |
|
hayato
2015/02/10 11:41:18
root.querySelector(".target") might be better in t
kojii
2015/02/12 09:51:29
Done.
| |
| 31 | |
| 32 host = document.getElementById("distributed"); | |
| 33 createShadowRootWithInnerHtml(host, "<div><content></content></div>"); | |
| 34 testTooltipTextInShadow("The title of distributed elements inherits in the compo sed tree", host); | |
|
hayato
2015/02/10 11:41:18
Looks this should be |#multiple .target| rather th
kojii
2015/02/12 09:51:29
Done.
| |
| 35 | |
| 36 host = document.getElementById("multiple"); | |
| 37 createShadowRootWithInnerHtml(host, "<content></content>"); | |
| 38 createShadowRootWithInnerHtml(host, "<div><content></content></div>"); | |
| 39 testTooltipTextInShadow("The title of distributed elements inherits in the compo sed tree (multiple shadow roots)", host); | |
| 40 | |
| 41 host = document.getElementById("multilevel"); | |
| 42 var host2ndLevel = createShadowRootWithInnerHtml(host, "<div><content></content> </div>").firstChild; | |
| 43 createShadowRootWithInnerHtml(host2ndLevel, "<div><content></content></div>"); | |
| 44 testTooltipTextInShadow("The title of distributed elements inherits in the compo sed tree (multiple levels)", host); | |
| 45 | |
| 46 host = document.getElementById("older"); | |
| 47 createShadowRootWithInnerHtml(host, style + "<div class=target>Older</div>"); | |
| 48 createShadowRootWithInnerHtml(host, "<div><shadow></shadow></div>"); | |
| 49 testTooltipTextInShadow("The title of elements in older shadow roots inherits in the composed tree", host); | |
| 50 | |
| 51 host = document.getElementById("multiple"); | |
| 52 createShadowRootWithInnerHtml(host, "<content></content>"); | |
| 53 createShadowRootWithInnerHtml(host, "<div><shadow></shadow></div>"); | |
| 54 testTooltipTextInShadow("The title of re-distributed elements inherits in the co mposed tree (multiple shadow roots)", host); | |
| 55 | |
| 56 function testTooltipTextInShadow(description, element) { | |
| 57 if (!window.eventSender || !window.testRunner) | |
| 58 return; | |
| 59 eventSender.dragMode = false; | |
| 60 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop + element.offs etHeight / 2); | |
| 61 test(function () { | |
| 62 assert_equals(testRunner.tooltipText, "PASS"); | |
| 63 }, description); | |
| 64 } | |
| 65 | |
| 66 function createShadowRootWithInnerHtml(host, shadowHtml) { | |
| 67 var root = host.createShadowRoot(); | |
| 68 root.innerHTML = shadowHtml; | |
| 69 return root; | |
| 70 } | |
| 71 | |
| 72 if (window.testRunner) | |
| 73 container.style.display = "none"; | |
| 74 done(); | |
| 75 </script> | |
| OLD | NEW |