3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
7 function removeInspectedNode()
9 document
.querySelector("#inspected").remove();
14 var stylesSidebarPane
= WebInspector
.panels
.elements
.sidebarPanes
.styles
;
15 InspectorTest
.runTestSuite([
16 function selectInspectedNode(next
)
18 InspectorTest
.selectNodeAndWaitForStyles("inspected", next
);
21 function startEditingAndReloadPage(next
)
23 var treeElement
= InspectorTest
.getElementStylePropertyTreeItem("color");
24 var currentDocumentId
= stylesSidebarPane
.node().ownerDocument
.id
;
25 treeElement
.startEditing(treeElement
.valueElement
);
26 var nodeRebuiltHappened
= false;
27 var pageReloadHappened
= false;
28 InspectorTest
.addSniffer(WebInspector
.StylesSidebarPane
.prototype, "_nodeStylesUpdatedForTest", onNodeRebuilt
);
29 InspectorTest
.reloadPage(reloadedCallback
);
31 function onNodeRebuilt(node
, rebuild
)
33 if (!node
|| node
.ownerDocument
.id
=== currentDocumentId
) {
34 InspectorTest
.addResult("ERROR: A rebuild update happened for the same node.");
35 InspectorTest
.completeTest();
38 nodeRebuiltHappened
= true;
42 function reloadedCallback()
44 pageReloadHappened
= true;
50 if (nodeRebuiltHappened
&& pageReloadHappened
)
55 function onPageReloaded(next
)
57 if (stylesSidebarPane
._isEditingStyle
) {
58 InspectorTest
.addResult("StylesSidebarPane should not be locked in editing on page reload.");
59 InspectorTest
.completeTest();
70 <body onload=
"runTest()">
72 Tests that reloading page during styles sidebar pane editing cancels editing and re-renders the
75 <div id=
"inspected" style=
"color: blue">Text
</div>