| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function addStyleClass() | 7 function addStyleClass() |
| 8 { | 8 { |
| 9 document.getElementById("inspected").className = "new-class"; | 9 document.getElementById("inspected").className = "new-class"; |
| 10 } | 10 } |
| 11 | 11 |
| 12 function test() | 12 function test() |
| 13 { | 13 { |
| 14 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); | 14 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); |
| 15 var treeOutline = InspectorTest.firstElementsTreeOutline(); | 15 var treeOutline = InspectorTest.firstElementsTreeOutline(); |
| 16 var seenRebuildUpdate; | 16 var seenRebuildUpdate; |
| 17 var seenAttrModified; | 17 var seenAttrModified; |
| 18 var modifiedAttrNodes = []; | 18 var modifiedAttrNodes = []; |
| 19 | 19 |
| 20 function attributeChanged(event) | 20 function attributeChanged(event) |
| 21 { | 21 { |
| 22 if (event.data.node === treeOutline.selectedDOMNode()) | 22 if (event.data.node === treeOutline.selectedDOMNode()) |
| 23 seenAttrModified = true; | 23 seenAttrModified = true; |
| 24 } | 24 } |
| 25 | 25 |
| 26 function rebuildUpdate() | 26 function rebuildUpdate() |
| 27 { | 27 { |
| 28 if (WebInspector.panels.elements._stylesWidget.node === treeOutline.sele
ctedDOMNode()) | 28 if (UI.panels.elements._stylesWidget.node === treeOutline.selectedDOMNod
e()) |
| 29 seenRebuildUpdate = true; | 29 seenRebuildUpdate = true; |
| 30 } | 30 } |
| 31 | 31 |
| 32 function step1() | 32 function step1() |
| 33 { | 33 { |
| 34 InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "doUp
date", rebuildUpdate); | 34 InspectorTest.addSniffer(Elements.StylesSidebarPane.prototype, "doUpdate
", rebuildUpdate); |
| 35 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events.Att
rModified, attributeChanged, this); | 35 InspectorTest.domModel.addEventListener(SDK.DOMModel.Events.AttrModified
, attributeChanged, this); |
| 36 // Click "Add new rule". | 36 // Click "Add new rule". |
| 37 document.querySelector(".styles-pane-toolbar").shadowRoot.querySelector(
".largeicon-add").click(); | 37 document.querySelector(".styles-pane-toolbar").shadowRoot.querySelector(
".largeicon-add").click(); |
| 38 InspectorTest.evaluateInPage("addStyleClass()", step2); | 38 InspectorTest.evaluateInPage("addStyleClass()", step2); |
| 39 } | 39 } |
| 40 | 40 |
| 41 function step2() | 41 function step2() |
| 42 { | 42 { |
| 43 if (!seenAttrModified) | 43 if (!seenAttrModified) |
| 44 InspectorTest.addResult("FAIL: AttrModified event not received."); | 44 InspectorTest.addResult("FAIL: AttrModified event not received."); |
| 45 else if (seenRebuildUpdate) | 45 else if (seenRebuildUpdate) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 <body onload="runTest()"> | 61 <body onload="runTest()"> |
| 62 <p> | 62 <p> |
| 63 Tests that modification of element styles while editing a selector does not comm
it the editor. | 63 Tests that modification of element styles while editing a selector does not comm
it the editor. |
| 64 </p> | 64 </p> |
| 65 | 65 |
| 66 <div id="inspected"></div> | 66 <div id="inspected"></div> |
| 67 | 67 |
| 68 </body> | 68 </body> |
| 69 </html> | 69 </html> |
| OLD | NEW |