1 function initialize_EditDOMTests()
4 InspectorTest.doAddAttribute = function(testName, dataNodeId, attributeText, next)
6 InspectorTest.domActionTestForNodeId(testName, dataNodeId, testBody, next);
8 function testBody(node, done)
10 var editorElement = InspectorTest.editNodePart(node, "webkit-html-attribute");
11 editorElement.dispatchEvent(InspectorTest.createKeyEvent("U+0009")); // Tab
13 InspectorTest.runAfterPendingDispatches(testContinuation);
15 function testContinuation()
17 var editorElement = window.getSelection().anchorNode.parentElement;
18 editorElement.textContent = attributeText;
19 editorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
20 InspectorTest.addSniffer(WebInspector.ElementsTreeUpdater.prototype, "_updateModifiedNodes", done);
25 InspectorTest.domActionTestForNodeId = function(testName, dataNodeId, testBody, next)
27 function callback(testNode, continuation)
29 InspectorTest.selectNodeWithId(dataNodeId, continuation);
31 InspectorTest.domActionTest(testName, callback, testBody, next);
34 InspectorTest.domActionTest = function(testName, dataNodeSelectionCallback, testBody, next)
36 var testNode = InspectorTest.expandedNodeWithId(testName);
37 InspectorTest.addResult("==== before ====");
38 InspectorTest.dumpElementsTree(testNode);
40 dataNodeSelectionCallback(testNode, step0);
44 InspectorTest.runAfterPendingDispatches(step1.bind(null, node));
49 testBody(node, step2);
54 InspectorTest.addResult("==== after ====");
55 InspectorTest.dumpElementsTree(testNode);
60 InspectorTest.editNodePart = function(node, className)
62 var treeElement = InspectorTest.firstElementsTreeOutline().findTreeElement(node);
63 var textElement = treeElement.listItemElement.getElementsByClassName(className)[0];
64 if (!textElement && treeElement.childrenListElement)
65 textElement = treeElement.childrenListElement.getElementsByClassName(className)[0];
66 treeElement._startEditingTarget(textElement);
70 InspectorTest.editNodePartAndRun = function(node, className, newValue, step2, useSniffer)
72 var editorElement = InspectorTest.editNodePart(node, className);
73 editorElement.textContent = newValue;
74 editorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
76 InspectorTest.addSniffer(WebInspector.ElementsTreeUpdater.prototype, "_updateModifiedNodes", step2);
78 InspectorTest.runAfterPendingDispatches(step2);