Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / styles / styles-cancel-editing.html
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>
6
7 function test()
8 {
9     InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
10
11     var treeElement;
12     var section;
13
14     function step1()
15     {
16         InspectorTest.dumpSelectedElementStyles(true);
17         treeElement = InspectorTest.getElementStylePropertyTreeItem("color");
18
19         treeElement.startEditing();
20         treeElement.nameElement.textContent = "color";
21         treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
22
23         // Update incrementally, do not commit.
24         treeElement.valueElement.textContent = "green";
25         treeElement.kickFreeFlowStyleEditForTest();
26
27         // Cancel editing.
28         treeElement.valueElement.firstChild.select();
29         InspectorTest.waitForStyleApplied(onStyleApplied);
30
31         function onStyleApplied()
32         {
33             treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("U+001B")); // Escape
34             InspectorTest.selectNodeWithId("other", step2);
35         }
36     }
37
38     function step2()
39     {
40         InspectorTest.selectNodeAndWaitForStyles("inspected", step3);
41     }
42
43     function step3()
44     {
45         InspectorTest.addResult("After append:");
46         InspectorTest.dumpSelectedElementStyles(true);
47         InspectorTest.completeTest();
48     }
49 }
50
51 </script>
52 </head>
53
54 <body onload="runTest()">
55 <p>
56 Tests that editing is canceled properly after incremental editing.
57 </p>
58
59 <div id="inspected" style="color: red">Text</div>
60 <div id="other"></div>
61
62 </body>
63 </html>