OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/elements-test.js"></script> |
| 5 <script> |
| 6 |
| 7 function test() |
| 8 { |
| 9 |
| 10 InspectorTest.runTestSuite([ |
| 11 function setup(next) |
| 12 { |
| 13 WebInspector.settings.showUAShadowDOM.set(true); |
| 14 InspectorTest.expandElementsTree(next); |
| 15 }, |
| 16 |
| 17 function testAuthorShadowRoot(next) |
| 18 { |
| 19 InspectorTest.findNode(isAuthorShadowRoot, selectReloadAndDump.bind(
null, next)); |
| 20 }, |
| 21 |
| 22 function testUserAgentShadowRoot(next) |
| 23 { |
| 24 InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bi
nd(null, next)); |
| 25 }, |
| 26 |
| 27 function testAuthorShadowRootChild(next) |
| 28 { |
| 29 InspectorTest.findNode(isAuthorShadowRootChild, selectReloadAndDump.
bind(null, next)); |
| 30 }, |
| 31 |
| 32 function testUserAgentShadowRootChild(next) |
| 33 { |
| 34 InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDu
mp.bind(null, next)); |
| 35 } |
| 36 ]); |
| 37 |
| 38 function isAuthorShadowRoot(node) |
| 39 { |
| 40 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.Author; |
| 41 } |
| 42 |
| 43 function isUserAgentShadowRoot(node) |
| 44 { |
| 45 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.UserAgent; |
| 46 } |
| 47 |
| 48 function isAuthorShadowRootChild(node) |
| 49 { |
| 50 return isAuthorShadowRoot(node.parentNode); |
| 51 } |
| 52 |
| 53 function isUserAgentShadowRootChild(node) |
| 54 { |
| 55 return isUserAgentShadowRoot(node.parentNode); |
| 56 } |
| 57 |
| 58 function selectReloadAndDump(next, node) |
| 59 { |
| 60 InspectorTest.selectNode(node); |
| 61 InspectorTest.reloadPage(step1); |
| 62 |
| 63 function step1() |
| 64 { |
| 65 InspectorTest.runAfterPendingDispatches(step2); |
| 66 } |
| 67 |
| 68 function step2() |
| 69 { |
| 70 dumpSelectedNode(); |
| 71 next(); |
| 72 } |
| 73 |
| 74 function dumpSelectedNode() |
| 75 { |
| 76 var selectedElement = WebInspector.panels.elements.treeOutline.selec
tedTreeElement; |
| 77 var nodeName = selectedElement ? selectedElement.representedObject.n
odeNameInCorrectCase() : "null"; |
| 78 InspectorTest.addResult("Selected node: '" + nodeName + "'"); |
| 79 } |
| 80 } |
| 81 } |
| 82 |
| 83 </script> |
| 84 </head> |
| 85 |
| 86 <body onload="runTest()"> |
| 87 <p> |
| 88 Tests that elements panel preserves selected shadow DOM node on page refresh. |
| 89 </p> |
| 90 <span id="hostElement"></span> |
| 91 <script> |
| 92 var root = document.getElementById("hostElement").createShadowRoot(); |
| 93 root.innerHTML = "<input type='text'>"; |
| 94 </script> |
| 95 </body> |
| 96 </html> |
OLD | NEW |