OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
5 <script src="../../../http/tests/inspector/elements-test.js"></script> | 5 <script src="../../../http/tests/inspector/elements-test.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 function loaded() | 8 function loaded() |
9 { | 9 { |
10 var template = document.querySelector("#tmpl"); | 10 var template = document.querySelector("#tmpl"); |
11 var root = document.querySelector("#host").createShadowRoot(); | 11 var root = document.querySelector("#host").createShadowRoot(); |
12 root.appendChild(template.content.cloneNode(true)); | 12 root.appendChild(template.content.cloneNode(true)); |
| 13 var rootClosed = document.querySelector("#hostClosed").createShadowRoot({mod
e: 'closed'}); |
| 14 rootClosed.appendChild(template.content.cloneNode(true)); |
13 runTest(); | 15 runTest(); |
14 } | 16 } |
15 | 17 |
16 function test() | 18 function test() |
17 { | 19 { |
18 WebInspector.settingForTest("showUAShadowDOM").set(true); | 20 WebInspector.settingForTest("showUAShadowDOM").set(true); |
19 InspectorTest.expandElementsTree(step0); | 21 InspectorTest.expandElementsTree(step0); |
20 | 22 |
21 function step0() | 23 function step0() |
22 { | 24 { |
23 selectNode(matchUserAgentShadowRoot, step1); | 25 selectNode(matchUserAgentShadowRoot, step1); |
24 } | 26 } |
25 | 27 |
26 function step1() | 28 function step1() |
27 { | 29 { |
28 InspectorTest.dumpBreadcrumb("User-agent shadow root breadcrumb"); | 30 InspectorTest.dumpBreadcrumb("User-agent shadow root breadcrumb"); |
29 selectNode(matchOpenShadowRoot, step2); | 31 selectNode(matchOpenShadowRoot, step2); |
30 } | 32 } |
31 | 33 |
32 function step2() | 34 function step2() |
33 { | 35 { |
34 InspectorTest.dumpBreadcrumb("Author shadow root breadcrumb"); | 36 InspectorTest.dumpBreadcrumb("Open shadow root breadcrumb"); |
| 37 selectNode(matchClosedShadowRoot, step3); |
| 38 } |
| 39 |
| 40 function step3() |
| 41 { |
| 42 InspectorTest.dumpBreadcrumb("Closed shadow root breadcrumb"); |
35 InspectorTest.completeTest(); | 43 InspectorTest.completeTest(); |
36 } | 44 } |
37 | 45 |
38 function selectNode(matchFunction, next) | 46 function selectNode(matchFunction, next) |
39 { | 47 { |
40 InspectorTest.findNode(matchFunction, callback); | 48 InspectorTest.findNode(matchFunction, callback); |
41 function callback(node) | 49 function callback(node) |
42 { | 50 { |
43 WebInspector.Revealer.revealPromise(node).then(next); | 51 WebInspector.Revealer.revealPromise(node).then(next); |
44 } | 52 } |
45 } | 53 } |
46 | 54 |
47 function matchUserAgentShadowRoot(node) | 55 function matchUserAgentShadowRoot(node) |
48 { | 56 { |
49 return node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Us
erAgent; | 57 return node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Us
erAgent; |
50 } | 58 } |
51 | 59 |
52 function matchOpenShadowRoot(node) | 60 function matchOpenShadowRoot(node) |
53 { | 61 { |
54 return node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Au
thor; | 62 return node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Op
en; |
| 63 } |
| 64 |
| 65 function matchClosedShadowRoot(node) |
| 66 { |
| 67 return node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Cl
osed; |
55 } | 68 } |
56 } | 69 } |
57 | 70 |
58 </script> | 71 </script> |
59 </head> | 72 </head> |
60 | 73 |
61 <body onload="loaded()"> | 74 <body onload="loaded()"> |
62 <p> | 75 <p> |
63 Tests that shadow roots are displayed correctly in breadcrumbs. | 76 Tests that shadow roots are displayed correctly in breadcrumbs. |
64 </p> | 77 </p> |
65 | 78 |
66 <input type="text"> | 79 <input type="text"> |
67 <div id="host"></div> | 80 <div id="host"></div> |
| 81 <div id="hostClosed"></div> |
68 <template id="tmpl"> | 82 <template id="tmpl"> |
69 <style>.red { color: red; }</style> | 83 <style>.red { color: red; }</style> |
70 <div id="inner" class="red">inner</div> | 84 <div id="inner" class="red">inner</div> |
71 </template> | 85 </template> |
72 | 86 |
73 | 87 |
74 </body> | 88 </body> |
75 </html> | 89 </html> |
OLD | NEW |