| 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 test() | 7 function test() |
| 8 { | 8 { |
| 9 WebInspector.showPanel("elements"); | 9 WebInspector.showPanel("elements"); |
| 10 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); | 10 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 printStyleSheetAndCall(step8); | 54 printStyleSheetAndCall(step8); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function step8() | 57 function step8() |
| 58 { | 58 { |
| 59 InspectorTest.completeTest(); | 59 InspectorTest.completeTest(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 function addNewRuleAndSelectNode(nodeId, next) | 62 function addNewRuleAndSelectNode(nodeId, next) |
| 63 { | 63 { |
| 64 // Click "Add new rule". | 64 function selectNode() |
| 65 document.getElementById("add-style-button-test-id").click(); | 65 { |
| 66 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; | 66 InspectorTest.selectNodeAndWaitForStyles(nodeId, next); |
| 67 section._selectorElement.textContent = "div.foo"; | 67 } |
| 68 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Ent
er")); | 68 |
| 69 InspectorTest.selectNodeAndWaitForStyles(nodeId, next); | 69 InspectorTest.addNewRule("div.foo", selectNode); |
| 70 } | 70 } |
| 71 | 71 |
| 72 function printStyleSheetAndCall(next) | 72 function printStyleSheetAndCall(next) |
| 73 { | 73 { |
| 74 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; | 74 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; |
| 75 var id = section.styleRule.style.id.styleSheetId; | 75 var id = section.styleRule.style.id.styleSheetId; |
| 76 CSSAgent.getStyleSheetText(id, callback); | 76 CSSAgent.getStyleSheetText(id, callback); |
| 77 function callback(result, styleSheetText) | 77 function callback(result, styleSheetText) |
| 78 { | 78 { |
| 79 InspectorTest.addResult("===== Style sheet text: ====="); | 79 InspectorTest.addResult("===== Style sheet text: ====="); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 <body onload="runTest()"> | 90 <body onload="runTest()"> |
| 91 <p> | 91 <p> |
| 92 Tests that adding a new rule can be undone. | 92 Tests that adding a new rule can be undone. |
| 93 </p> | 93 </p> |
| 94 | 94 |
| 95 <div class="foo" id="inspected" style="font-size: 12px">Text</div> | 95 <div class="foo" id="inspected" style="font-size: 12px">Text</div> |
| 96 <div class="foo" id="other" style="color:red"></div> | 96 <div class="foo" id="other" style="color:red"></div> |
| 97 | 97 |
| 98 </body> | 98 </body> |
| 99 </html> | 99 </html> |
| OLD | NEW |