Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-4 / undo-add-property.html
blob886fffaba09f5be1e82425ac809d59efce579bc3
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
6 <style>
7 .container {
8 font-weight: bold
10 </style>
12 <script>
14 function test()
16 InspectorTest.selectNodeAndWaitForStyles("container", testAppendProperty);
18 function testAppendProperty()
20 InspectorTest.addResult("=== Last property ===");
21 testAddProperty("margin-left: 2px", undefined, testInsertBegin);
24 function testInsertBegin()
26 InspectorTest.addResult("=== First property ===");
27 testAddProperty("margin-top: 0px", 0, testInsertMiddle);
30 function testInsertMiddle()
32 InspectorTest.addResult("=== Middle property ===");
33 testAddProperty("margin-right: 1px", 1, InspectorTest.completeTest.bind(InspectorTest));
36 function testAddProperty(propertyText, index, callback)
38 InspectorTest.addResult("(Initial value)");
39 InspectorTest.dumpSelectedElementStyles(true);
41 var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("font-weight");
42 var treeElement = treeItem.section().addNewBlankProperty(index);
43 treeElement.applyStyleText(propertyText, true);
44 InspectorTest.waitForStyles("container", step1);
46 function step1()
48 InspectorTest.addResult("(After adding property)");
49 InspectorTest.dumpSelectedElementStyles(true);
51 InspectorTest.domModel.undo();
52 InspectorTest.selectNodeAndWaitForStyles("other", step2);
55 function step2()
57 InspectorTest.addResult("(After undo)");
58 InspectorTest.dumpSelectedElementStyles(true);
60 InspectorTest.domModel.redo();
61 InspectorTest.selectNodeAndWaitForStyles("container", step3);
64 function step3()
66 InspectorTest.addResult("(After redo)");
67 InspectorTest.dumpSelectedElementStyles(true);
68 callback();
72 </script>
73 </head>
75 <body onload="runTest()">
76 <p>
77 Tests that adding a property is undone properly.
78 </p>
80 <div id="container" class="container"></div>
81 <div id="other" class="container"></div>
83 </body>
84 </html>