OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <link rel="stylesheet" href="resources/style.css"> | 3 <link rel="stylesheet" href="resources/style.css"> |
4 <script src="../inspector/inspector-test.js"></script> | 4 <script src="../inspector/inspector-test.js"></script> |
5 <script src="../inspector/elements-test.js"></script> | 5 <script src="../inspector/elements-test.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 function reopenWebInspector(objectId) | 8 function reopenWebInspector(objectId) |
9 { | 9 { |
10 window.didReopen = 1; | 10 window.didReopen = 1; |
(...skipping 26 matching lines...) Expand all Loading... |
37 } else { | 37 } else { |
38 InspectorTest.addResult("Opening front-end second time"); | 38 InspectorTest.addResult("Opening front-end second time"); |
39 InspectorTest.addResult("Dump styles after inspector was reopened:")
; | 39 InspectorTest.addResult("Dump styles after inspector was reopened:")
; |
40 dump(InspectorTest.completeTest); | 40 dump(InspectorTest.completeTest); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 function testFirstOpen() | 44 function testFirstOpen() |
45 { | 45 { |
46 InspectorTest.addResult("Dump initial styles:"); | 46 InspectorTest.addResult("Dump initial styles:"); |
47 dump(step2); | 47 dump(onStylesDumped); |
48 | 48 |
49 function step2() | 49 function onStylesDumped() |
50 { | 50 { |
51 treeElement = InspectorTest.getMatchedStylePropertyTreeItem("color")
; | 51 treeElement = InspectorTest.getMatchedStylePropertyTreeItem("color")
; |
52 treeElement.startEditing(); | 52 treeElement.startEditing(); |
53 treeElement.nameElement.textContent = "color"; | 53 treeElement.nameElement.textContent = "color"; |
54 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("
Enter")); | 54 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("
Enter")); |
55 | 55 |
56 // Commit editing. | 56 // Commit editing. |
57 treeElement.valueElement.textContent = "green"; | 57 treeElement.valueElement.textContent = "green"; |
58 treeElement.valueElement.firstChild.select(); | 58 treeElement.valueElement.firstChild.select(); |
59 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent(
"Enter")); | 59 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent(
"Enter")); |
60 InspectorTest.runAfterPendingDispatches(step3); | 60 InspectorTest.waitForStyleApplied(onPropertyEdited); |
61 } | 61 } |
62 | 62 |
63 function step3() | 63 function onPropertyEdited() |
| 64 { |
| 65 InspectorTest.addNewRule("#testDiv, my-custom-tag", onFirstRuleAdded
); |
| 66 } |
| 67 |
| 68 function onFirstRuleAdded() |
| 69 { |
| 70 InspectorTest.addNewRule("#testDiv, another-custom-tag", onSecondRul
eAdded); |
| 71 } |
| 72 |
| 73 function onSecondRuleAdded() |
| 74 { |
| 75 WebInspector.domModel.undo(onRuleRemoved); |
| 76 } |
| 77 |
| 78 function onRuleRemoved() |
64 { | 79 { |
65 InspectorTest.selectNodeAndWaitForStyles("other", step4); | 80 InspectorTest.selectNodeAndWaitForStyles("other", step4); |
66 } | 81 } |
67 | 82 |
68 function step4() | 83 function step4() |
69 { | 84 { |
70 InspectorTest.addResult("Dump styles after editing:"); | 85 InspectorTest.addResult("Dump styles after editing:"); |
71 dump(reopenInspector); | 86 dump(reopenInspector); |
72 } | 87 } |
73 } | 88 } |
74 | 89 |
75 function reopenInspector() | 90 function reopenInspector() |
76 { | 91 { |
77 InspectorTest.flushResults(); | 92 InspectorTest.flushResults(); |
78 InspectorTest.evaluateInPage("reopenWebInspector()"); | 93 InspectorTest.evaluateInPage("reopenWebInspector()"); |
79 } | 94 } |
80 | 95 |
81 function dump(callback) | 96 function dump(callback) |
82 { | 97 { |
83 InspectorTest.selectNodeAndWaitForStyles("testDiv", step2); | 98 InspectorTest.selectNodeAndWaitForStyles("testDiv", step2); |
84 | 99 |
85 function step2() | 100 function step2() |
86 { | 101 { |
87 InspectorTest.dumpSelectedElementStyles(true); | 102 InspectorTest.dumpSelectedElementStyles(true); |
88 callback(); | 103 callback(); |
89 } | 104 } |
90 } | 105 } |
91 } | 106 } |
92 </script> | 107 </script> |
93 </head> | 108 </head> |
94 | 109 |
95 <body onload="initTest()"> | 110 <body onload="initTest()"> |
96 <p>This test checks that styles edited through inspector are correctly shown upo
n reattach.</p> | 111 <p>This test checks that styles edited through inspector are correctly shown upo
n reattach.</p> |
97 <div id="testDiv"></div> | 112 <div id="testDiv"></div> |
98 <div id="other"></div> | 113 <div id="other"></div> |
99 </body> | 114 </body> |
100 </html> | 115 </html> |
OLD | NEW |