| 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 testClosedShadowRoot(next) | |
| 23 { | |
| 24 InspectorTest.findNode(isClosedShadowRoot, selectReloadAndDump.bind(
null, next)); | |
| 25 }, | |
| 26 | |
| 27 function testUserAgentShadowRoot(next) | |
| 28 { | |
| 29 InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bi
nd(null, next)); | |
| 30 }, | |
| 31 | |
| 32 function testOpenShadowRootChild(next) | |
| 33 { | |
| 34 InspectorTest.findNode(isOpenShadowRootChild, selectReloadAndDump.bi
nd(null, next)); | |
| 35 }, | |
| 36 | |
| 37 function testClosedShadowRootChild(next) | |
| 38 { | |
| 39 InspectorTest.findNode(isClosedShadowRootChild, selectReloadAndDump.
bind(null, next)); | |
| 40 }, | |
| 41 | |
| 42 function testUserAgentShadowRootChild(next) | |
| 43 { | |
| 44 InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDu
mp.bind(null, next)); | |
| 45 } | |
| 46 ]); | |
| 47 | |
| 48 function isOpenShadowRoot(node) | |
| 49 { | |
| 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; | |
| 56 } | |
| 57 | |
| 58 function isUserAgentShadowRoot(node) | |
| 59 { | |
| 60 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.UserAgent; | |
| 61 } | |
| 62 | |
| 63 function isOpenShadowRootChild(node) | |
| 64 { | |
| 65 return isOpenShadowRoot(node.parentNode); | |
| 66 } | |
| 67 | |
| 68 function isClosedShadowRootChild(node) | |
| 69 { | |
| 70 return isClosedShadowRoot(node.parentNode); | |
| 71 } | |
| 72 | |
| 73 function isUserAgentShadowRootChild(node) | |
| 74 { | |
| 75 return isUserAgentShadowRoot(node.parentNode); | |
| 76 } | |
| 77 | |
| 78 function selectReloadAndDump(next, node) | |
| 79 { | |
| 80 InspectorTest.selectNode(node).then(step0); | |
| 81 | |
| 82 function step0() | |
| 83 { | |
| 84 InspectorTest.reloadPage(step1); | |
| 85 } | |
| 86 | |
| 87 function step1() | |
| 88 { | |
| 89 InspectorTest.runAfterPendingDispatches(step2); | |
| 90 } | |
| 91 | |
| 92 function step2() | |
| 93 { | |
| 94 dumpSelectedNode(); | |
| 95 next(); | |
| 96 } | |
| 97 | |
| 98 function dumpSelectedNode() | |
| 99 { | |
| 100 var selectedElement = InspectorTest.firstElementsTreeOutline().selec
tedTreeElement; | |
| 101 var nodeName = selectedElement ? selectedElement.node().nodeNameInCo
rrectCase() : "null"; | |
| 102 InspectorTest.addResult("Selected node: '" + nodeName + "'"); | |
| 103 } | |
| 104 } | |
| 105 } | |
| 106 | |
| 107 </script> | |
| 108 </head> | |
| 109 | |
| 110 <body onload="runTest()"> | |
| 111 <p> | |
| 112 Tests that elements panel preserves selected shadow DOM node on page refresh. | |
| 113 </p> | |
| 114 <span id="hostElement"></span><span id="closedHostElement"></span> | |
| 115 <script> | |
| 116 var root = document.getElementById("hostElement").createShadowRoot(); | |
| 117 root.innerHTML = "<input type='text'>"; | |
| 118 var closedRoot = document.getElementById("closedHostElement").attachShadow({mode
: 'closed'}); | |
| 119 closedRoot.innerHTML = "<button></button>"; | |
| 120 </script> | |
| 121 </body> | |
| 122 </html> | |
| OLD | NEW |