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 InspectorTest
.selectNodeAndWaitForStyles("inspected", step1
);
15 var treeOutline
= InspectorTest
.firstElementsTreeOutline();
16 var seenRebuildUpdate
;
18 var modifiedAttrNodes
= [];
20 function attributeChanged(event
)
22 if (event
.data
.node
=== treeOutline
.selectedDOMNode())
23 seenAttrModified
= true;
26 function rebuildUpdate()
28 if (WebInspector
.panels
.elements
.sidebarPanes
.styles
.node
=== treeOutline
.selectedDOMNode())
29 seenRebuildUpdate
= true;
34 InspectorTest
.addSniffer(WebInspector
.StylesSidebarPane
.prototype, "doUpdate", rebuildUpdate
);
35 InspectorTest
.domModel
.addEventListener(WebInspector
.DOMModel
.Events
.AttrModified
, attributeChanged
, this);
36 // Click "Add new rule".
37 document
.querySelector(".styles-pane-toolbar").shadowRoot
.querySelector(".add-toolbar-item").click();
38 InspectorTest
.evaluateInPage("addStyleClass()", step2
);
43 if (!seenAttrModified
)
44 InspectorTest
.addResult("FAIL: AttrModified event not received.");
45 else if (seenRebuildUpdate
)
46 InspectorTest
.addResult("FAIL: Styles pane updated while a selector editor was active.");
48 InspectorTest
.addResult("SUCCESS: Styles pane not updated.");
49 InspectorTest
.completeTest();
61 <body onload=
"runTest()">
63 Tests that modification of element styles while editing a selector does not commit the editor.
66 <div id=
"inspected"></div>