blob: a622bb0887ac3083d1f02783f132a1145bb744dd [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script>
function test()
{
WebInspector.showPanel("elements");
InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
var treeElement;
var section;
function step1()
{
InspectorTest.dumpSelectedElementStyles(true);
treeElement = InspectorTest.getElementStylePropertyTreeItem("color");
treeElement.startEditing();
treeElement.nameElement.textContent = "color";
treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
// Update incrementally, do not commit.
treeElement.valueElement.textContent = "green";
treeElement.kickFreeFlowStyleEditForTest();
// Cancel editing.
treeElement.valueElement.firstChild.select();
treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("U+001B")); // Escape
InspectorTest.runAfterPendingDispatches(step2);
}
function step2()
{
InspectorTest.selectNodeWithId("other");
InspectorTest.runAfterPendingDispatches(step3);
}
function step3()
{
InspectorTest.selectNodeAndWaitForStyles("inspected", step4);
}
function step4()
{
InspectorTest.addResult("After append:");
InspectorTest.dumpSelectedElementStyles(true);
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>
Tests that editing is canceled properly after incremental editing.
</p>
<div id="inspected" style="color: red">Text</div>
<div id="other"></div>
</body>
</html>