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 | |
6 <style> | |
7 .container { | |
8 font-weight: bold | |
9 } | |
10 </style> | |
11 | |
12 <script> | |
13 | |
14 function test() | |
15 { | |
16 InspectorTest.selectNodeAndWaitForStyles("container", testAppendProperty); | |
17 | |
18 function testAppendProperty() | |
19 { | |
20 InspectorTest.addResult("=== Last property ==="); | |
21 testAddProperty("margin-left: 2px", undefined, testInsertBegin); | |
22 } | |
23 | |
24 function testInsertBegin() | |
25 { | |
26 InspectorTest.addResult("=== First property ==="); | |
27 testAddProperty("margin-top: 0px", 0, testInsertMiddle); | |
28 } | |
29 | |
30 function testInsertMiddle() | |
31 { | |
32 InspectorTest.addResult("=== Middle property ==="); | |
33 testAddProperty("margin-right: 1px", 1, InspectorTest.completeTest.bind(
InspectorTest)); | |
34 } | |
35 | |
36 function testAddProperty(propertyText, index, callback) | |
37 { | |
38 InspectorTest.addResult("(Initial value)"); | |
39 InspectorTest.dumpSelectedElementStyles(true); | |
40 | |
41 var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("font-weigh
t"); | |
42 var treeElement = treeItem.section().addNewBlankProperty(index); | |
43 treeElement.applyStyleText(propertyText, true); | |
44 InspectorTest.waitForStyles("container", step1); | |
45 | |
46 function step1() | |
47 { | |
48 InspectorTest.addResult("(After adding property)"); | |
49 InspectorTest.dumpSelectedElementStyles(true); | |
50 | |
51 InspectorTest.domModel.undo(); | |
52 InspectorTest.selectNodeAndWaitForStyles("other", step2); | |
53 } | |
54 | |
55 function step2() | |
56 { | |
57 InspectorTest.addResult("(After undo)"); | |
58 InspectorTest.dumpSelectedElementStyles(true); | |
59 | |
60 InspectorTest.domModel.redo(); | |
61 InspectorTest.selectNodeAndWaitForStyles("container", step3); | |
62 } | |
63 | |
64 function step3() | |
65 { | |
66 InspectorTest.addResult("(After redo)"); | |
67 InspectorTest.dumpSelectedElementStyles(true); | |
68 callback(); | |
69 } | |
70 } | |
71 } | |
72 </script> | |
73 </head> | |
74 | |
75 <body onload="runTest()"> | |
76 <p> | |
77 Tests that adding a property is undone properly. | |
78 </p> | |
79 | |
80 <div id="container" class="container"></div> | |
81 <div id="other" class="container"></div> | |
82 | |
83 </body> | |
84 </html> | |
OLD | NEW |