blob: c26dadbc42cb5cb25025c5ac7f5e3a51eb139535 [file] [log] [blame]
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script src="elements-tests.js"></script>
<script>
function doit()
{
function callback(result)
{
if (result === "reload")
window.location.reload();
else {
output("Selected element should be 'P', was: '" + result + "'");
notifyDone();
}
}
evaluateInWebInspector("frontend_selectElement", callback);
}
// Frontend functions.
function frontend_selectElement(testController)
{
if (window.refreshCalled) {
// We should have "test-topic" element selected after refresh.
var selectedElement = WebInspector.panels.elements.treeOutline.selectedTreeElement;
return selectedElement ? selectedElement.representedObject.nodeName : "null";
} else {
// Select the "test-topic" element.
testController.waitUntilDone();
frontend_expandDOMSubtreeAndRun(testController, null, frontend_selectElementContinuation);
}
}
function frontend_selectElementContinuation(testController)
{
var node = frontend_nodeForId("test-topic");
if (node) {
WebInspector.panels.elements.treeOutline.revealAndSelectNode(node);
window.refreshCalled = true;
testController.notifyDone("reload");
return;
}
testController.notifyDone("FAIL");
}
</script>
</head>
<body onload="onload()">
<p id="test-topic">
Tests that elements panel preserves selected node on page refresh.
</p>
</body>
</html>