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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 function initialize_EditDOMTests()
2 {
3
4 InspectorTest.doAddAttribute = function(testName, dataNodeId, attributeText, nex t)
5 {
6 InspectorTest.domActionTestForNodeId(testName, dataNodeId, testBody, next);
7
8 function testBody(node, done)
9 {
10 var editorElement = InspectorTest.editNodePart(node, "webkit-html-attrib ute");
11 editorElement.dispatchEvent(InspectorTest.createKeyEvent("U+0009")); // Tab
12
13 InspectorTest.runAfterPendingDispatches(testContinuation);
14
15 function testContinuation()
16 {
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);
21 }
22 }
23 }
24
25 InspectorTest.domActionTestForNodeId = function(testName, dataNodeId, testBody, next)
26 {
27 function callback(testNode, continuation)
28 {
29 InspectorTest.selectNodeWithId(dataNodeId, continuation);
30 }
31 InspectorTest.domActionTest(testName, callback, testBody, next);
32 }
33
34 InspectorTest.domActionTest = function(testName, dataNodeSelectionCallback, test Body, next)
35 {
36 var testNode = InspectorTest.expandedNodeWithId(testName);
37 InspectorTest.addResult("==== before ====");
38 InspectorTest.dumpElementsTree(testNode);
39
40 dataNodeSelectionCallback(testNode, step0);
41
42 function step0(node)
43 {
44 InspectorTest.runAfterPendingDispatches(step1.bind(null, node));
45 }
46
47 function step1(node)
48 {
49 testBody(node, step2);
50 }
51
52 function step2()
53 {
54 InspectorTest.addResult("==== after ====");
55 InspectorTest.dumpElementsTree(testNode);
56 next();
57 }
58 }
59
60 InspectorTest.editNodePart = function(node, className)
61 {
62 var treeElement = WebInspector.panels.elements.treeOutline.findTreeElement(n ode);
63 var textElement = treeElement.listItemElement.getElementsByClassName(classNa me)[0];
64 if (!textElement && treeElement.childrenListElement)
65 textElement = treeElement.childrenListElement.getElementsByClassName(cla ssName)[0];
66 treeElement._startEditingTarget(textElement);
67 return textElement;
68 }
69
70 InspectorTest.editNodePartAndRun = function(node, className, newValue, step2, us eSniffer)
71 {
72 var editorElement = InspectorTest.editNodePart(node, className);
73 editorElement.textContent = newValue;
74 editorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
75 if (useSniffer)
76 InspectorTest.addSniffer(WebInspector.ElementsTreeUpdater.prototype, "_u pdateModifiedNodes", step2);
77 else
78 InspectorTest.runAfterPendingDispatches(step2);
79 }
80
81 }
OLDNEW
« 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