Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-3 / styles-cancel-editing.html
blob8c55acfedc10befedda6357e3f249938b9ad4257
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;
12 var section;
14 function step1()
16 InspectorTest.dumpSelectedElementStyles(true);
17 treeElement = InspectorTest.getElementStylePropertyTreeItem("color");
19 treeElement.startEditing();
20 treeElement.nameElement.textContent = "color";
21 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
23 // Update incrementally, do not commit.
24 treeElement.valueElement.textContent = "green";
25 treeElement.kickFreeFlowStyleEditForTest();
27 // Cancel editing.
28 treeElement.valueElement.firstChild.select();
29 InspectorTest.waitForStyleApplied(onStyleApplied);
31 function onStyleApplied()
33 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("U+001B")); // Escape
34 InspectorTest.waitForStyleApplied(onStyleReverted);
37 function onStyleReverted()
39 InspectorTest.selectNodeWithId("other", step2);
43 function step2()
45 InspectorTest.selectNodeAndWaitForStyles("inspected", step3);
48 function step3()
50 InspectorTest.addResult("After append:");
51 InspectorTest.dumpSelectedElementStyles(true);
52 InspectorTest.completeTest();
56 </script>
57 </head>
59 <body onload="runTest()">
60 <p>
61 Tests that editing is canceled properly after incremental editing.
62 </p>
64 <div id="inspected" style="color: red">Text</div>
65 <div id="other"></div>
67 </body>
68 </html>