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); |
11 | 11 |
12 var treeElement; | 12 var treeElement; |
13 | 13 |
14 function step1() | 14 function step1() |
15 { | 15 { |
16 // Click add new rule | 16 // Click "Add new rule". |
17 document.getElementById("add-style-button-test-id").click(); | 17 document.getElementById("add-style-button-test-id").click(); |
18 InspectorTest.selectNodeAndWaitForStyles("other", step2); | 18 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; |
| 19 section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Ent
er")); |
| 20 InspectorTest.runAfterPendingDispatches(step2); |
19 } | 21 } |
20 | 22 |
21 function step2() { | 23 function step2() |
22 // Click add new rule | 24 { |
23 document.getElementById("add-style-button-test-id").click(); | 25 var section = WebInspector.panels.elements.sidebarPanes.styles.sections[
0][2]; |
24 InspectorTest.selectNodeAndWaitForStyles("inspected", step3); | 26 var newProperty = section.addNewBlankProperty(); |
| 27 newProperty.startEditing(); |
| 28 newProperty.nameElement.textContent = "color"; |
| 29 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Ente
r")); |
| 30 newProperty.valueElement.textContent = "maroon"; |
| 31 newProperty.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Ent
er")); |
| 32 InspectorTest.selectNodeAndWaitForStyles("other", step3); |
25 } | 33 } |
26 | 34 |
27 function step3() | 35 function step3() |
28 { | 36 { |
29 InspectorTest.addResult("After adding new rule (inspected):"); | 37 // Click "Add new rule". |
30 InspectorTest.dumpSelectedElementStyles(true, false, true); | 38 document.getElementById("add-style-button-test-id").click(); |
31 InspectorTest.selectNodeAndWaitForStyles("other", step4); | 39 InspectorTest.selectNodeAndWaitForStyles("inspected", step4); |
32 } | 40 } |
33 | 41 |
34 function step4() | 42 function step4() |
35 { | 43 { |
| 44 InspectorTest.addResult("After adding new rule (inspected):"); |
| 45 InspectorTest.dumpSelectedElementStyles(true, false, true); |
| 46 InspectorTest.selectNodeAndWaitForStyles("other", step5); |
| 47 } |
| 48 |
| 49 function step5() |
| 50 { |
36 InspectorTest.addResult("After adding new rule (other):"); | 51 InspectorTest.addResult("After adding new rule (other):"); |
37 InspectorTest.dumpSelectedElementStyles(true, false, true); | 52 InspectorTest.dumpSelectedElementStyles(true, false, true); |
38 InspectorTest.completeTest(); | 53 InspectorTest.completeTest(); |
39 } | 54 } |
40 } | 55 } |
41 | 56 |
42 </script> | 57 </script> |
43 </head> | 58 </head> |
44 | 59 |
45 <body onload="runTest()"> | 60 <body onload="runTest()"> |
46 <p> | 61 <p> |
47 Tests that adding a new rule works after sitching nodes. | 62 Tests that adding a new rule works after switching nodes. |
48 </p> | 63 </p> |
49 | 64 |
50 <div id="inspected" style="font-size: 12px">Text</div> | 65 <div id="inspected" style="font-size: 12px">Text</div> |
51 <div id="other" style="color:red"></div> | 66 <div id="other" style="color:red"></div> |
52 | 67 |
53 </body> | 68 </body> |
54 </html> | 69 </html> |
OLD | NEW |