OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function test() | 7 function test() |
8 { | 8 { |
9 | 9 |
10 InspectorTest.runTestSuite([ | 10 InspectorTest.runTestSuite([ |
11 function setup(next) | 11 function setup(next) |
12 { | 12 { |
13 WebInspector.settingForTest("showUAShadowDOM").set(true); | 13 WebInspector.settingForTest("showUAShadowDOM").set(true); |
14 InspectorTest.expandElementsTree(next); | 14 InspectorTest.expandElementsTree(next); |
15 }, | 15 }, |
16 | 16 |
17 function testOpenShadowRoot(next) | 17 function testOpenShadowRoot(next) |
18 { | 18 { |
19 InspectorTest.findNode(isOpenShadowRoot, selectReloadAndDump.bind(nu
ll, next)); | 19 InspectorTest.findNode(isOpenShadowRoot, selectReloadAndDump.bind(nu
ll, next)); |
20 }, | 20 }, |
21 | 21 |
| 22 function testClosedShadowRoot(next) |
| 23 { |
| 24 InspectorTest.findNode(isClosedShadowRoot, selectReloadAndDump.bind(
null, next)); |
| 25 }, |
| 26 |
22 function testUserAgentShadowRoot(next) | 27 function testUserAgentShadowRoot(next) |
23 { | 28 { |
24 InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bi
nd(null, next)); | 29 InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bi
nd(null, next)); |
25 }, | 30 }, |
26 | 31 |
27 function testOpenShadowRootChild(next) | 32 function testOpenShadowRootChild(next) |
28 { | 33 { |
29 InspectorTest.findNode(isOpenShadowRootChild, selectReloadAndDump.bi
nd(null, next)); | 34 InspectorTest.findNode(isOpenShadowRootChild, selectReloadAndDump.bi
nd(null, next)); |
30 }, | 35 }, |
31 | 36 |
| 37 function testClosedShadowRootChild(next) |
| 38 { |
| 39 InspectorTest.findNode(isClosedShadowRootChild, selectReloadAndDump.
bind(null, next)); |
| 40 }, |
| 41 |
32 function testUserAgentShadowRootChild(next) | 42 function testUserAgentShadowRootChild(next) |
33 { | 43 { |
34 InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDu
mp.bind(null, next)); | 44 InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDu
mp.bind(null, next)); |
35 } | 45 } |
36 ]); | 46 ]); |
37 | 47 |
38 function isOpenShadowRoot(node) | 48 function isOpenShadowRoot(node) |
39 { | 49 { |
40 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.Author; | 50 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.Open; |
| 51 } |
| 52 |
| 53 function isClosedShadowRoot(node) |
| 54 { |
| 55 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.Closed; |
41 } | 56 } |
42 | 57 |
43 function isUserAgentShadowRoot(node) | 58 function isUserAgentShadowRoot(node) |
44 { | 59 { |
45 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.UserAgent; | 60 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.UserAgent; |
46 } | 61 } |
47 | 62 |
48 function isOpenShadowRootChild(node) | 63 function isOpenShadowRootChild(node) |
49 { | 64 { |
50 return isOpenShadowRoot(node.parentNode); | 65 return isOpenShadowRoot(node.parentNode); |
51 } | 66 } |
52 | 67 |
| 68 function isClosedShadowRootChild(node) |
| 69 { |
| 70 return isClosedShadowRoot(node.parentNode); |
| 71 } |
| 72 |
53 function isUserAgentShadowRootChild(node) | 73 function isUserAgentShadowRootChild(node) |
54 { | 74 { |
55 return isUserAgentShadowRoot(node.parentNode); | 75 return isUserAgentShadowRoot(node.parentNode); |
56 } | 76 } |
57 | 77 |
58 function selectReloadAndDump(next, node) | 78 function selectReloadAndDump(next, node) |
59 { | 79 { |
60 InspectorTest.selectNode(node).then(step0); | 80 InspectorTest.selectNode(node).then(step0); |
61 | 81 |
62 function step0() | 82 function step0() |
(...skipping 21 matching lines...) Expand all Loading... |
84 } | 104 } |
85 } | 105 } |
86 | 106 |
87 </script> | 107 </script> |
88 </head> | 108 </head> |
89 | 109 |
90 <body onload="runTest()"> | 110 <body onload="runTest()"> |
91 <p> | 111 <p> |
92 Tests that elements panel preserves selected shadow DOM node on page refresh. | 112 Tests that elements panel preserves selected shadow DOM node on page refresh. |
93 </p> | 113 </p> |
94 <span id="hostElement"></span> | 114 <span id="hostElement"></span><span id="closedHostElement"></span> |
95 <script> | 115 <script> |
96 var root = document.getElementById("hostElement").createShadowRoot(); | 116 var root = document.getElementById("hostElement").createShadowRoot(); |
97 root.innerHTML = "<input type='text'>"; | 117 root.innerHTML = "<input type='text'>"; |
| 118 var closedRoot = document.getElementById("closedHostElement").createShadowRoot({
mode: 'closed'}); |
| 119 closedRoot.innerHTML = "<button></button>"; |
98 </script> | 120 </script> |
99 </body> | 121 </body> |
100 </html> | 122 </html> |
OLD | NEW |