Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: LayoutTests/inspector/elements/edit-dom-test.js

Issue 206503002: DevTools: Allow general editing of author shadow DOM elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/elements/edit-dom-test.js
diff --git a/LayoutTests/inspector/elements/edit-dom-test.js b/LayoutTests/inspector/elements/edit-dom-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b69ca4ebf3bb8731411e615bc04ed12de35b35f3
--- /dev/null
+++ b/LayoutTests/inspector/elements/edit-dom-test.js
@@ -0,0 +1,81 @@
+function initialize_EditDOMTests()
+{
+
+InspectorTest.doAddAttribute = function(testName, dataNodeId, attributeText, next)
+{
+ InspectorTest.domActionTestForNodeId(testName, dataNodeId, testBody, next);
+
+ function testBody(node, done)
+ {
+ var editorElement = InspectorTest.editNodePart(node, "webkit-html-attribute");
+ editorElement.dispatchEvent(InspectorTest.createKeyEvent("U+0009")); // Tab
+
+ InspectorTest.runAfterPendingDispatches(testContinuation);
+
+ function testContinuation()
+ {
+ var editorElement = window.getSelection().anchorNode.parentElement;
+ editorElement.textContent = attributeText;
+ editorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
+ InspectorTest.addSniffer(WebInspector.ElementsTreeUpdater.prototype, "_updateModifiedNodes", done);
+ }
+ }
+}
+
+InspectorTest.domActionTestForNodeId = function(testName, dataNodeId, testBody, next)
+{
+ function callback(testNode, continuation)
+ {
+ InspectorTest.selectNodeWithId(dataNodeId, continuation);
+ }
+ InspectorTest.domActionTest(testName, callback, testBody, next);
+}
+
+InspectorTest.domActionTest = function(testName, dataNodeSelectionCallback, testBody, next)
+{
+ var testNode = InspectorTest.expandedNodeWithId(testName);
+ InspectorTest.addResult("==== before ====");
+ InspectorTest.dumpElementsTree(testNode);
+
+ dataNodeSelectionCallback(testNode, step0);
+
+ function step0(node)
+ {
+ InspectorTest.runAfterPendingDispatches(step1.bind(null, node));
+ }
+
+ function step1(node)
+ {
+ testBody(node, step2);
+ }
+
+ function step2()
+ {
+ InspectorTest.addResult("==== after ====");
+ InspectorTest.dumpElementsTree(testNode);
+ next();
+ }
+}
+
+InspectorTest.editNodePart = function(node, className)
+{
+ var treeElement = WebInspector.panels.elements.treeOutline.findTreeElement(node);
+ var textElement = treeElement.listItemElement.getElementsByClassName(className)[0];
+ if (!textElement && treeElement.childrenListElement)
+ textElement = treeElement.childrenListElement.getElementsByClassName(className)[0];
+ treeElement._startEditingTarget(textElement);
+ return textElement;
+}
+
+InspectorTest.editNodePartAndRun = function(node, className, newValue, step2, useSniffer)
+{
+ var editorElement = InspectorTest.editNodePart(node, className);
+ editorElement.textContent = newValue;
+ editorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
+ if (useSniffer)
+ InspectorTest.addSniffer(WebInspector.ElementsTreeUpdater.prototype, "_updateModifiedNodes", step2);
+ else
+ InspectorTest.runAfterPendingDispatches(step2);
+}
+
+}
« no previous file with comments | « LayoutTests/inspector/elements/edit-dom-actions-shadow-expected.txt ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698