| Index: LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html
|
| diff --git a/LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html b/LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f3f7ea1d7625101d85f42d1da646d68307201bb6
|
| --- /dev/null
|
| +++ b/LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html
|
| @@ -0,0 +1,96 @@
|
| +<html>
|
| +<head>
|
| +<script src="../../http/tests/inspector/inspector-test.js"></script>
|
| +<script src="../../http/tests/inspector/elements-test.js"></script>
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| +
|
| + InspectorTest.runTestSuite([
|
| + function setup(next)
|
| + {
|
| + WebInspector.settings.showUAShadowDOM.set(true);
|
| + InspectorTest.expandElementsTree(next);
|
| + },
|
| +
|
| + function testAuthorShadowRoot(next)
|
| + {
|
| + InspectorTest.findNode(isAuthorShadowRoot, selectReloadAndDump.bind(null, next));
|
| + },
|
| +
|
| + function testUserAgentShadowRoot(next)
|
| + {
|
| + InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bind(null, next));
|
| + },
|
| +
|
| + function testAuthorShadowRootChild(next)
|
| + {
|
| + InspectorTest.findNode(isAuthorShadowRootChild, selectReloadAndDump.bind(null, next));
|
| + },
|
| +
|
| + function testUserAgentShadowRootChild(next)
|
| + {
|
| + InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDump.bind(null, next));
|
| + }
|
| + ]);
|
| +
|
| + function isAuthorShadowRoot(node)
|
| + {
|
| + return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Author;
|
| + }
|
| +
|
| + function isUserAgentShadowRoot(node)
|
| + {
|
| + return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.UserAgent;
|
| + }
|
| +
|
| + function isAuthorShadowRootChild(node)
|
| + {
|
| + return isAuthorShadowRoot(node.parentNode);
|
| + }
|
| +
|
| + function isUserAgentShadowRootChild(node)
|
| + {
|
| + return isUserAgentShadowRoot(node.parentNode);
|
| + }
|
| +
|
| + function selectReloadAndDump(next, node)
|
| + {
|
| + InspectorTest.selectNode(node);
|
| + InspectorTest.reloadPage(step1);
|
| +
|
| + function step1()
|
| + {
|
| + InspectorTest.runAfterPendingDispatches(step2);
|
| + }
|
| +
|
| + function step2()
|
| + {
|
| + dumpSelectedNode();
|
| + next();
|
| + }
|
| +
|
| + function dumpSelectedNode()
|
| + {
|
| + var selectedElement = WebInspector.panels.elements.treeOutline.selectedTreeElement;
|
| + var nodeName = selectedElement ? selectedElement.representedObject.nodeNameInCorrectCase() : "null";
|
| + InspectorTest.addResult("Selected node: '" + nodeName + "'");
|
| + }
|
| + }
|
| +}
|
| +
|
| +</script>
|
| +</head>
|
| +
|
| +<body onload="runTest()">
|
| +<p>
|
| +Tests that elements panel preserves selected shadow DOM node on page refresh.
|
| +</p>
|
| +<span id="hostElement"></span>
|
| +<script>
|
| +var root = document.getElementById("hostElement").createShadowRoot();
|
| +root.innerHTML = "<input type='text'>";
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|