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 InspectorTest.addNewRule("foo, div#inspected, bar", step2); | |
24 } | |
25 | |
26 function step2() | |
27 { | |
28 var section = InspectorTest.firstMatchedStyleSection(); | |
29 var newProperty = section.addNewBlankProperty(); | |
30 newProperty.startEditing(); | |
31 textInputController.insertText("color"); | |
32 eventSender.keyDown(":"); | |
33 textInputController.insertText("maroon"); | |
34 InspectorTest.waitForStyleApplied(step3); | |
35 eventSender.keyDown(";"); | |
36 } | |
37 | |
38 function step3() { | |
39 InspectorTest.selectNodeAndWaitForStyles("other", step4); | |
40 } | |
41 | |
42 function step4() | |
43 { | |
44 InspectorTest.addNewRule(null, onRuleAdded); | |
45 | |
46 function onRuleAdded() | |
47 { | |
48 InspectorTest.selectNodeAndWaitForStyles("inspected", step5); | |
49 } | |
50 } | |
51 | |
52 function step5() | |
53 { | |
54 InspectorTest.addResult("After adding new rule (inspected):"); | |
55 InspectorTest.dumpSelectedElementStyles(true, false, true, true); | |
56 InspectorTest.selectNodeAndWaitForStyles("other", step6); | |
57 } | |
58 | |
59 function step6() | |
60 { | |
61 InspectorTest.addResult("After adding new rule (other):"); | |
62 InspectorTest.dumpSelectedElementStyles(true, false, true); | |
63 InspectorTest.completeTest(); | |
64 } | |
65 | |
66 function revisionAdded(revision) | |
67 { | |
68 InspectorTest.addResult("Revision added: " + this.displayName()); | |
69 } | |
70 } | |
71 | |
72 </script> | |
73 </head> | |
74 | |
75 <body onload="runTest()"> | |
76 <p> | |
77 Tests that adding a new rule works after switching nodes. | |
78 </p> | |
79 | |
80 <div id="inspected" style="font-size: 12px">Text</div> | |
81 <div id="other" style="color:red"></div> | |
82 | |
83 </body> | |
84 </html> | |
OLD | NEW |