function test()
{
WebInspector.inspectorView.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();
- }
+ InspectorTest.runTestSuite([
+ function selectInitialNode(next)
+ {
+ InspectorTest.selectNodeAndWaitForStyles("inspected", next);
+ },
+
+ function testFreeFlowEdit(next)
+ {
+ 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(/*";
+ InspectorTest.addSniffer(WebInspector.StylePropertyTreeElement.prototype, "styleTextAppliedForTest", next);
+ treeElement.kickFreeFlowStyleEditForTest();
+ },
+
+ function testCommitEditing(next)
+ {
+ // Commit editing.
+ treeElement.valueElement.textContent = "green";
+ treeElement.valueElement.firstChild.select();
+ InspectorTest.addSniffer(WebInspector.StylePropertiesSection.prototype, "_afterUpdateFinishedForTest", next);
+ treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
+ },
+
+ function testNewPropertyEditorIsCreated(next)
+ {
+ var blankTreeElement = treeOutline.children[1];
+ if (!WebInspector.isBeingEdited(blankTreeElement.nameElement)) {
+ InspectorTest.addResult("No new property editor active!");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ // Test Styles pane editor looping.
+ InspectorTest.addSniffer(WebInspector.StylePropertiesSection.prototype, "_afterUpdateFinishedForTest", next);
+ blankTreeElement.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
+ },
+
+ function testCycleThroughPropertyEditing(next)
+ {
+ if (!WebInspector.isBeingEdited(treeOutline.children[0].nameElement)) {
+ InspectorTest.addResult("Original property name editor not active!");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ InspectorTest.selectNodeWithId("other");
+ InspectorTest.runAfterPendingDispatches(next);
+ },
+
+ function testNodeStyles(next)
+ {
+ InspectorTest.selectNodeAndWaitForStyles("inspected", next);
+ },
- // 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();
+ function dumpStyles(next)
+ {
+ InspectorTest.addResult("After append:");
+ InspectorTest.dumpSelectedElementStyles(true);
+ next();
}
+ ]);
- InspectorTest.selectNodeWithId("other");
- InspectorTest.runAfterPendingDispatches(step3);
- }
-
- function step3()
- {
- InspectorTest.selectNodeAndWaitForStyles("inspected", step4);
- }
-
- function step4()
- {
- InspectorTest.addResult("After append:");
- InspectorTest.dumpSelectedElementStyles(true);
- InspectorTest.completeTest();
- }
}
</script>