3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script>
10 InspectorTest.runTestSuite([
13 WebInspector.settings.showUAShadowDOM.set(true);
14 InspectorTest.expandElementsTree(next);
17 function testAuthorShadowRoot(next)
19 InspectorTest.findNode(isAuthorShadowRoot, selectReloadAndDump.bind(null, next));
22 function testUserAgentShadowRoot(next)
24 InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bind(null, next));
27 function testAuthorShadowRootChild(next)
29 InspectorTest.findNode(isAuthorShadowRootChild, selectReloadAndDump.bind(null, next));
32 function testUserAgentShadowRootChild(next)
34 InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDump.bind(null, next));
38 function isAuthorShadowRoot(node)
40 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Author;
43 function isUserAgentShadowRoot(node)
45 return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.UserAgent;
48 function isAuthorShadowRootChild(node)
50 return isAuthorShadowRoot(node.parentNode);
53 function isUserAgentShadowRootChild(node)
55 return isUserAgentShadowRoot(node.parentNode);
58 function selectReloadAndDump(next, node)
60 InspectorTest.selectNode(node).then(step0);
64 InspectorTest.reloadPage(step1);
69 InspectorTest.runAfterPendingDispatches(step2);
78 function dumpSelectedNode()
80 var selectedElement = InspectorTest.firstElementsTreeOutline().selectedTreeElement;
81 var nodeName = selectedElement ? selectedElement.representedObject.nodeNameInCorrectCase() : "null";
82 InspectorTest.addResult("Selected node: '" + nodeName + "'");
90 <body onload="runTest()">
92 Tests that elements panel preserves selected shadow DOM node on page refresh.
94 <span id="hostElement"></span>
96 var root = document.getElementById("hostElement").createShadowRoot();
97 root.innerHTML = "<input type='text'>";