| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function test() | |
| 8 { | |
| 9 if (!window.eventSender || !window.textInputController) { | |
| 10 document.write("This test does not work in manual mode."); | |
| 11 InspectorTest.completeTest(); | |
| 12 return; | |
| 13 } | |
| 14 | |
| 15 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); | |
| 16 InspectorTest.addSniffer(WebInspector.UISourceCode.prototype, "addRevision",
revisionAdded); | |
| 17 | |
| 18 var treeElement; | |
| 19 var hasResourceChanged; | |
| 20 | |
| 21 function step1() | |
| 22 { | |
| 23 // Click "Add new rule". | |
| 24 InspectorTest.addNewRule("foo, div#inspected, bar", step2); | |
| 25 } | |
| 26 | |
| 27 function step2() | |
| 28 { | |
| 29 var section = InspectorTest.firstMatchedStyleSection(); | |
| 30 var newProperty = section.addNewBlankProperty(); | |
| 31 newProperty.startEditing(); | |
| 32 textInputController.insertText("color"); | |
| 33 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("U+00
09")); // Tab | |
| 34 textInputController.insertText("maroon"); | |
| 35 newProperty.valueElement.dispatchEvent(InspectorTest.createKeyEvent("U+0
009")); // Tab | |
| 36 InspectorTest.selectNodeAndWaitForStyles("other", step3); | |
| 37 } | |
| 38 | |
| 39 function step3() | |
| 40 { | |
| 41 // Click "Add new rule". | |
| 42 InspectorTest.addNewRule(null, onRuleAdded); | |
| 43 | |
| 44 function onRuleAdded() | |
| 45 { | |
| 46 InspectorTest.selectNodeAndWaitForStyles("inspected", step4); | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 function step4() | |
| 51 { | |
| 52 InspectorTest.addResult("After adding new rule (inspected):"); | |
| 53 InspectorTest.dumpSelectedElementStyles(true, false, true, true); | |
| 54 InspectorTest.selectNodeAndWaitForStyles("other", step5); | |
| 55 } | |
| 56 | |
| 57 function step5() | |
| 58 { | |
| 59 InspectorTest.addResult("After adding new rule (other):"); | |
| 60 InspectorTest.dumpSelectedElementStyles(true, false, true); | |
| 61 InspectorTest.completeTest(); | |
| 62 } | |
| 63 | |
| 64 function revisionAdded(revision) | |
| 65 { | |
| 66 InspectorTest.addResult("Revision added: " + this.displayName()); | |
| 67 } | |
| 68 } | |
| 69 | |
| 70 </script> | |
| 71 </head> | |
| 72 | |
| 73 <body onload="runTest()"> | |
| 74 <p> | |
| 75 Tests that adding a new rule works after switching nodes. | |
| 76 </p> | |
| 77 | |
| 78 <div id="inspected" style="font-size: 12px">Text</div> | |
| 79 <div id="other" style="color:red"></div> | |
| 80 | |
| 81 </body> | |
| 82 </html> | |
| OLD | NEW |