OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 .target { | 5 .target { |
6 background-color:blue; | 6 background-color:blue; |
7 color:white; | 7 color:white; |
8 width:100px; height:40px; | 8 width:100px; height:40px; |
9 margin:10px; | 9 margin:10px; |
10 } | 10 } |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 if (!window.eventSender || !window.testRunner) | 25 if (!window.eventSender || !window.testRunner) |
26 test(function () { assert_unreached(); }, "Cannot automate the tests without
eventSender and testRunner"); | 26 test(function () { assert_unreached(); }, "Cannot automate the tests without
eventSender and testRunner"); |
27 | 27 |
28 var host = document.getElementById("fromdoc"); | 28 var host = document.getElementById("fromdoc"); |
29 var root = createShadowRootWithInnerHtml(host, style + "<div class=target>Shadow
</div>"); | 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(".target"), "PASS-fromdoc"); | 30 testTooltipTextInShadow("The title of elements in shadow inherits from the docum
ent", root.querySelector(".target"), "PASS-fromdoc"); |
31 | 31 |
32 host = document.getElementById("distributed"); | 32 host = document.getElementById("distributed"); |
33 createShadowRootWithInnerHtml(host, "<div title='PASS-distributed'><content></co
ntent></div>"); | 33 createShadowRootWithInnerHtml(host, "<div title='PASS-distributed'><content></co
ntent></div>"); |
34 testTooltipTextInShadow("The title of distributed elements inherits in the compo
sed tree", host.querySelector(".target"), "PASS-distributed"); | 34 testTooltipTextInShadow("The title of distributed elements inherits in the flat
tree", host.querySelector(".target"), "PASS-distributed"); |
35 | 35 |
36 host = document.getElementById("multiple"); | 36 host = document.getElementById("multiple"); |
37 createShadowRootWithInnerHtml(host, "<div title='NG-multiple'><content></content
></div>"); | 37 createShadowRootWithInnerHtml(host, "<div title='NG-multiple'><content></content
></div>"); |
38 createShadowRootWithInnerHtml(host, "<div title='PASS-multiple'><content></conte
nt></div>"); | 38 createShadowRootWithInnerHtml(host, "<div title='PASS-multiple'><content></conte
nt></div>"); |
39 testTooltipTextInShadow("The title of distributed elements inherits in the compo
sed tree (multiple shadow roots)", host.querySelector(".target"), "PASS-multiple
"); | 39 testTooltipTextInShadow("The title of distributed elements inherits in the flat
tree (multiple shadow roots)", host.querySelector(".target"), "PASS-multiple"); |
40 | 40 |
41 host = document.getElementById("multilevel"); | 41 host = document.getElementById("multilevel"); |
42 var host2ndLevel = createShadowRootWithInnerHtml(host, "<div title='NG-multileve
l'><content></content></div>").firstChild; | 42 var host2ndLevel = createShadowRootWithInnerHtml(host, "<div title='NG-multileve
l'><content></content></div>").firstChild; |
43 createShadowRootWithInnerHtml(host2ndLevel, "<div title='PASS-multilevel'><conte
nt></content></div>"); | 43 createShadowRootWithInnerHtml(host2ndLevel, "<div title='PASS-multilevel'><conte
nt></content></div>"); |
44 testTooltipTextInShadow("The title of distributed elements inherits in the compo
sed tree (multiple levels)", host.querySelector(".target"), "PASS-multilevel"); | 44 testTooltipTextInShadow("The title of distributed elements inherits in the flat
tree (multiple levels)", host.querySelector(".target"), "PASS-multilevel"); |
45 | 45 |
46 host = document.getElementById("older"); | 46 host = document.getElementById("older"); |
47 root = createShadowRootWithInnerHtml(host, style + "<div class=target>Older</div
>"); | 47 root = createShadowRootWithInnerHtml(host, style + "<div class=target>Older</div
>"); |
48 createShadowRootWithInnerHtml(host, "<div title='PASS-older'><shadow></shadow></
div>"); | 48 createShadowRootWithInnerHtml(host, "<div title='PASS-older'><shadow></shadow></
div>"); |
49 testTooltipTextInShadow("The title of elements in older shadow roots inherits in
the composed tree", root.querySelector(".target"), "PASS-older"); | 49 testTooltipTextInShadow("The title of elements in older shadow roots inherits in
the flat tree", root.querySelector(".target"), "PASS-older"); |
50 | 50 |
51 host = document.getElementById("redistributed"); | 51 host = document.getElementById("redistributed"); |
52 createShadowRootWithInnerHtml(host, "<content></content>"); | 52 createShadowRootWithInnerHtml(host, "<content></content>"); |
53 createShadowRootWithInnerHtml(host, "<div title='PASS-redistributed'><shadow></s
hadow></div>"); | 53 createShadowRootWithInnerHtml(host, "<div title='PASS-redistributed'><shadow></s
hadow></div>"); |
54 testTooltipTextInShadow("The title of re-distributed elements inherits in the co
mposed tree (multiple shadow roots)", host.querySelector(".target"), "PASS-redis
tributed"); | 54 testTooltipTextInShadow("The title of re-distributed elements inherits in the fl
at tree (multiple shadow roots)", host.querySelector(".target"), "PASS-redistrib
uted"); |
55 | 55 |
56 function testTooltipTextInShadow(description, element, expected) { | 56 function testTooltipTextInShadow(description, element, expected) { |
57 if (!window.eventSender || !window.testRunner) | 57 if (!window.eventSender || !window.testRunner) |
58 return; | 58 return; |
59 eventSender.dragMode = false; | 59 eventSender.dragMode = false; |
60 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop + element.offs
etHeight / 2); | 60 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop + element.offs
etHeight / 2); |
61 test(function () { | 61 test(function () { |
62 assert_equals(testRunner.tooltipText, expected); | 62 assert_equals(testRunner.tooltipText, expected); |
63 }, description); | 63 }, description); |
64 } | 64 } |
65 | 65 |
66 function createShadowRootWithInnerHtml(host, shadowHtml) { | 66 function createShadowRootWithInnerHtml(host, shadowHtml) { |
67 var root = host.createShadowRoot(); | 67 var root = host.createShadowRoot(); |
68 root.innerHTML = shadowHtml; | 68 root.innerHTML = shadowHtml; |
69 return root; | 69 return root; |
70 } | 70 } |
71 | 71 |
72 if (window.testRunner) | 72 if (window.testRunner) |
73 container.style.display = "none"; | 73 container.style.display = "none"; |
74 done(); | 74 done(); |
75 </script> | 75 </script> |
OLD | NEW |