3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
14 InspectorTest.runTestSuite([
15 function selectInitialNode(next)
17 InspectorTest.selectNodeAndWaitForStyles("inspected", next);
20 function testFreeFlowEdit(next)
22 InspectorTest.dumpSelectedElementStyles(true);
23 treeElement = InspectorTest.getElementStylePropertyTreeItem("color");
24 treeOutline = treeElement.treeOutline;
26 treeElement.startEditing();
27 treeElement.nameElement.textContent = "color";
28 treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
30 // Update incrementally, do not commit.
31 treeElement.valueElement.textContent = "rgb(/*";
32 InspectorTest.waitForStyleApplied(next);
33 treeElement.kickFreeFlowStyleEditForTest();
36 function testCommitEditing(next)
39 treeElement.valueElement.textContent = "green";
40 treeElement.valueElement.firstChild.select();
41 InspectorTest.addSniffer(WebInspector.StylePropertiesSection.prototype, "_afterUpdateFinishedForTest", next);
42 treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
45 function testNewPropertyEditorIsCreated(next)
47 var blankTreeElement = treeOutline.children[1];
48 if (!WebInspector.isBeingEdited(blankTreeElement.nameElement)) {
49 InspectorTest.addResult("No new property editor active!");
50 InspectorTest.completeTest();
54 // Test Styles pane editor looping.
55 InspectorTest.addSniffer(WebInspector.StylePropertiesSection.prototype, "_afterUpdateFinishedForTest", next);
56 blankTreeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
59 function testCycleThroughPropertyEditing(next)
61 if (!WebInspector.isBeingEdited(treeOutline.children[0].nameElement)) {
62 InspectorTest.addResult("Original property name editor not active!");
63 InspectorTest.completeTest();
67 InspectorTest.selectNodeWithId("other", next);
70 function testNodeStyles(next)
72 InspectorTest.selectNodeAndWaitForStyles("inspected", next);
75 function dumpStyles(next)
77 InspectorTest.addResult("After append:");
78 InspectorTest.dumpSelectedElementStyles(true);
88 <body onload="runTest()">
90 Tests that editing is canceled properly after incremental editing.
93 <div id="inspected" style="color: red">Text</div>
94 <div id="other"></div>