3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
7 function addStyleClass()
9 document.getElementById("inspected").className = "new-class";
14 WebInspector.inspectorView.showPanel("elements");
15 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
16 var treeOutline = WebInspector.panels.elements.treeOutline;
17 var seenRebuildUpdate;
19 var modifiedAttrNodes = [];
21 function attributeChanged(event)
23 if (event.data.node === treeOutline.selectedDOMNode())
24 seenAttrModified = true;
27 function rebuildUpdate()
29 if (WebInspector.panels.elements.sidebarPanes.styles.node === treeOutline.selectedDOMNode())
30 seenRebuildUpdate = true;
35 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_rebuildUpdate", rebuildUpdate);
36 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrModified, attributeChanged, this);
37 // Click "Add new rule".
38 document.getElementById("add-style-button-test-id").click();
39 InspectorTest.evaluateInPage("addStyleClass()", step2);
44 if (!seenAttrModified)
45 InspectorTest.addResult("FAIL: AttrModified event not received.");
46 else if (seenRebuildUpdate)
47 InspectorTest.addResult("FAIL: Styles pane updated while a selector editor was active.");
49 InspectorTest.addResult("SUCCESS: Styles pane not updated.");
50 InspectorTest.completeTest();
62 <body onload="runTest()">
64 Tests that modification of element styles while editing a selector does not commit the editor.
67 <div id="inspected"></div>