| 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.settingForTest("showUAShadowDOM").set(true); | |
| 14 InspectorTest.expandElementsTree(next); | |
| 15 }, | |
| 16 | |
| 17 function testOpenShadowRoot(next) | |
| 18 { | |
| 19 InspectorTest.findNode(isOpenShadowRoot, selectReloadAndDump.bind(nu
ll, next)); | |
| 20 }, | |
| 21 | |
| 22 function testUserAgentShadowRoot(next) | |
| 23 { | |
| 24 InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bi
nd(null, next)); | |
| 25 }, | |
| 26 | |
| 27 function testOpenShadowRootChild(next) | |
| 28 { | |
| 29 InspectorTest.findNode(isOpenShadowRootChild, selectReloadAndDump.bi
nd(null, next)); | |
| 30 }, | |
| 31 | |
| 32 function testUserAgentShadowRootChild(next) | |
| 33 { | |
| 34 InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDu
mp.bind(null, next)); | |
| 35 } | |
| 36 ]); | |
| 37 | |
| 38 function isOpenShadowRoot(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 isOpenShadowRootChild(node) | |
| 49 { | |
| 50 return isOpenShadowRoot(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).then(step0); | |
| 61 | |
| 62 function step0() | |
| 63 { | |
| 64 InspectorTest.reloadPage(step1); | |
| 65 } | |
| 66 | |
| 67 function step1() | |
| 68 { | |
| 69 InspectorTest.runAfterPendingDispatches(step2); | |
| 70 } | |
| 71 | |
| 72 function step2() | |
| 73 { | |
| 74 dumpSelectedNode(); | |
| 75 next(); | |
| 76 } | |
| 77 | |
| 78 function dumpSelectedNode() | |
| 79 { | |
| 80 var selectedElement = InspectorTest.firstElementsTreeOutline().selec
tedTreeElement; | |
| 81 var nodeName = selectedElement ? selectedElement.node().nodeNameInCo
rrectCase() : "null"; | |
| 82 InspectorTest.addResult("Selected node: '" + nodeName + "'"); | |
| 83 } | |
| 84 } | |
| 85 } | |
| 86 | |
| 87 </script> | |
| 88 </head> | |
| 89 | |
| 90 <body onload="runTest()"> | |
| 91 <p> | |
| 92 Tests that elements panel preserves selected shadow DOM node on page refresh. | |
| 93 </p> | |
| 94 <span id="hostElement"></span> | |
| 95 <script> | |
| 96 var root = document.getElementById("hostElement").createShadowRoot(); | |
| 97 root.innerHTML = "<input type='text'>"; | |
| 98 </script> | |
| 99 </body> | |
| 100 </html> | |
| OLD | NEW |