3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/elements-test.js"></script>
9 InspectorTest
.selectNodeAndWaitForStyles("inspected", step1
);
15 addNewRuleAndSelectNode("other", step2
);
20 addNewRuleAndSelectNode("inspected", step3
);
25 InspectorTest
.addResult("After adding new rule:");
26 InspectorTest
.dumpSelectedElementStyles(true, false, true);
27 printStyleSheetAndCall(step4
);
32 InspectorTest
.domModel
.undo();
33 InspectorTest
.selectNodeAndWaitForStyles("other", step5
);
38 InspectorTest
.addResult("After undo:");
39 InspectorTest
.dumpSelectedElementStyles(true, false, true);
40 printStyleSheetAndCall(step6
);
45 InspectorTest
.domModel
.redo();
46 InspectorTest
.selectNodeAndWaitForStyles("inspected", step7
);
51 InspectorTest
.addResult("After redo:");
52 InspectorTest
.dumpSelectedElementStyles(true, false, true);
53 printStyleSheetAndCall(step8
);
58 InspectorTest
.completeTest();
61 function addNewRuleAndSelectNode(nodeId
, next
)
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("=============================");
89 <body onload=
"runTest()">
91 Tests that adding a new rule can be undone.
94 <div class=
"foo" id=
"inspected" style=
"font-size: 12px">Text
</div>
95 <div class=
"foo" id=
"other" style=
"color:red"></div>