| <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 treeOutline; |
| var section; |
| |
| function step1() |
| { |
| InspectorTest.dumpSelectedElementStyles(true); |
| treeElement = InspectorTest.getElementStylePropertyTreeItem("color"); |
| treeOutline = treeElement.treeOutline; |
| |
| treeElement.startEditing(); |
| treeElement.nameElement.textContent = "color"; |
| treeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter")); |
| |
| // Update incrementally, do not commit. |
| treeElement.valueElement.textContent = "rgb(/*"; |
| treeElement.kickFreeFlowStyleEditForTest(); |
| |
| // Commit editing. |
| treeElement.valueElement.textContent = "green"; |
| treeElement.valueElement.firstChild.select(); |
| treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter")); |
| InspectorTest.runAfterPendingDispatches(step2); |
| } |
| |
| function step2() |
| { |
| var blankTreeElement = treeOutline.children[1]; |
| if (!WebInspector.isBeingEdited(blankTreeElement.nameElement)) { |
| InspectorTest.addResult("No new property editor active!"); |
| InspectorTest.completeTest(); |
| } |
| |
| // Test Styles pane editor looping. |
| blankTreeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter")); |
| if (!WebInspector.isBeingEdited(treeOutline.children[0].nameElement)) { |
| InspectorTest.addResult("Original property name editor not active!"); |
| InspectorTest.completeTest(); |
| } |
| |
| 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> |