Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / styles / undo-set-selector-text.html
1 <html>
2 <head>
3 <style>
4 #inspected {
5   color: green;
6 }
7 </style>
8 <script src="../../../http/tests/inspector/inspector-test.js"></script>
9 <script src="../../../http/tests/inspector/elements-test.js"></script>
10 <script>
11
12 function test()
13 {
14     WebInspector.showPanel("elements");
15     InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
16
17     function step1()
18     {
19         InspectorTest.addResult("=== Before selector modification ===");
20         InspectorTest.dumpSelectedElementStyles(true);
21         var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
22         section.startEditingSelector();
23         section._selectorElement.textContent = "#inspected, #other";
24         section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
25         InspectorTest.selectNodeAndWaitForStyles("other", step2);
26     }
27
28     function step2()
29     {
30         InspectorTest.addResult("=== After selector modification ===");
31         InspectorTest.dumpSelectedElementStyles(true);
32         WebInspector.domAgent.undo();
33         InspectorTest.selectNodeAndWaitForStyles("inspected", step3);
34     }
35
36     function step3()
37     {
38         InspectorTest.addResult("=== After undo ===");
39         InspectorTest.dumpSelectedElementStyles(true);
40
41         WebInspector.domAgent.redo();
42         InspectorTest.selectNodeAndWaitForStyles("other", step4);
43     }
44
45     function step4()
46     {
47         InspectorTest.addResult("=== After redo ===");
48         InspectorTest.dumpSelectedElementStyles(true);
49         InspectorTest.completeTest();
50     }
51 }
52
53 </script>
54 </head>
55
56 <body onload="runTest()">
57 <p>
58 Tests that setting selector text can be undone.
59 </p>
60
61 <div id="inspected"></div>
62 <div id="other"></div>
63
64 </body>
65 </html>