Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-4 / undo-add-new-rule.html
blob61643ad6ca04482c5a493753e08e4353f8eebcdb
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>
7 function test()
9 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
11 var treeElement;
13 function step1()
15 addNewRuleAndSelectNode("other", step2);
18 function step2()
20 addNewRuleAndSelectNode("inspected", step3);
23 function step3()
25 InspectorTest.addResult("After adding new rule:");
26 InspectorTest.dumpSelectedElementStyles(true, false, true);
27 printStyleSheetAndCall(step4);
30 function step4()
32 InspectorTest.domModel.undo();
33 InspectorTest.selectNodeAndWaitForStyles("other", step5);
36 function step5()
38 InspectorTest.addResult("After undo:");
39 InspectorTest.dumpSelectedElementStyles(true, false, true);
40 printStyleSheetAndCall(step6);
43 function step6()
45 InspectorTest.domModel.redo();
46 InspectorTest.selectNodeAndWaitForStyles("inspected", step7);
49 function step7()
51 InspectorTest.addResult("After redo:");
52 InspectorTest.dumpSelectedElementStyles(true, false, true);
53 printStyleSheetAndCall(step8);
56 function step8()
58 InspectorTest.completeTest();
61 function addNewRuleAndSelectNode(nodeId, next)
63 function selectNode()
65 InspectorTest.selectNodeAndWaitForStyles(nodeId, next);
68 InspectorTest.addNewRule("div.foo", selectNode);
71 function printStyleSheetAndCall(next)
73 var section = InspectorTest.firstMatchedStyleSection();
74 var id = section.styleRule.style().styleSheetId;
75 InspectorTest.CSSAgent.getStyleSheetText(id, callback);
76 function callback(error, styleSheetText)
78 InspectorTest.addResult("===== Style sheet text: =====");
79 InspectorTest.addResult(styleSheetText);
80 InspectorTest.addResult("=============================");
81 next();
86 </script>
87 </head>
89 <body onload="runTest()">
90 <p>
91 Tests that adding a new rule can be undone.
92 </p>
94 <div class="foo" id="inspected" style="font-size: 12px">Text</div>
95 <div class="foo" id="other" style="color:red"></div>
97 </body>
98 </html>