Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / highlight / highlight-dom-updates.html
blob5cf329bdc01b0d80a03a6c895dab4ead197de033
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
5 <script src="../../../http/tests/inspector/console-test.js"></script>
6 <script>
8 function appendChild(parentId, id)
10 var e = document.createElement("span");
11 e.id = id;
12 document.getElementById(parentId).appendChild(e);
15 function remove(id)
17 document.getElementById(id).remove();
20 function removeFirstChild(id)
22 document.getElementById(id).firstChild.remove();
25 function setAttribute(id, name, value)
27 var e = document.getElementById(id);
28 if (value === undefined)
29 e.removeAttribute(name);
30 else
31 e.setAttribute(name, value);
34 function setTextContent(id, content)
36 document.getElementById(id).textContent = content;
39 function setFirstChildTextContent(id, content)
41 document.getElementById(id).firstChild.textContent = content;
44 function test()
46 var attrTestNode;
47 var childTestNode;
48 var textTestNode;
50 InspectorTest.runTestSuite([
51 function testDumpInitial(next)
53 function callback(node)
55 attrTestNode = InspectorTest.expandedNodeWithId("attrTest");
56 childTestNode = InspectorTest.expandedNodeWithId("childTest");
57 textTestNode = InspectorTest.expandedNodeWithId("textTest");
58 next();
60 InspectorTest.addResult("========= Original ========");
61 InspectorTest.dumpDOMUpdateHighlights(null);
62 InspectorTest.expandElementsTree(callback);
65 function testSetAttributeOtherValue(next)
67 runAndDumpHighlights("setAttribute('attrTest', 'attrFoo', 'bar')", attrTestNode, next);
70 function testSetAttributeEmpty(next)
72 runAndDumpHighlights("setAttribute('attrTest', 'attrFoo', '')", attrTestNode, next);
75 function testAddAttribute(next)
77 runAndDumpHighlights("setAttribute('attrTest', 'attrBar', 'newBar')", attrTestNode, next);
80 function testRemoveAttribute(next)
82 runAndDumpHighlights("setAttribute('attrTest', 'attrFoo')", attrTestNode, next);
85 function testAppendChildToEmpty(next)
87 runAndDumpHighlights("appendChild('childTest', 'child1')", childTestNode, callback);
88 function callback()
90 // Expand the #childTest node.
91 InspectorTest.expandElementsTree(next);
95 function testAppendChildToExpanded(next)
97 runAndDumpHighlights("appendChild('childTest', 'child2')", childTestNode, next);
100 function testRemoveChild1(next)
102 runAndDumpHighlights("remove('child1')", childTestNode, next);
105 function testRemoveChild2(next)
107 runAndDumpHighlights("remove('child2')", childTestNode, next);
110 function testSetTextContent(next)
112 runAndDumpHighlights("setTextContent('textTest', 'Text')", textTestNode, next);
115 function testSetTextNodeTextContent(next)
117 runAndDumpHighlights("setFirstChildTextContent('textTest', 'NewText')", textTestNode, next);
120 function testRemoveInlineTextNode(next)
122 runAndDumpHighlights("removeFirstChild('textTest')", textTestNode, next);
125 function testSetTextContentWithEmptyText(next)
127 runAndDumpHighlights("setTextContent('textTest', 'Text')", textTestNode, next);
130 function testClearTextNodeTextContent(next)
132 runAndDumpHighlights("setFirstChildTextContent('textTest', '')", textTestNode, next);
135 function testAppendChildWhenHidden(next)
137 WebInspector.ConsolePanel.show();
138 runAndDumpHighlights("appendChild('childTest', 'child1')", childTestNode, next);
142 function runAndDumpHighlights(script, root, next)
144 dumpHighlights(root, next);
145 InspectorTest.evaluateInPage(script);
148 function dumpHighlights(root, next)
150 InspectorTest.dumpDOMUpdateHighlights(root, callback);
152 function callback()
154 var treeOutline = InspectorTest.firstElementsTreeOutline();
155 var highlights = treeOutline._element.getElementsByClassName("dom-update-highlight");
156 for (var i = 0; i < highlights.length; ++i)
157 highlights[i].classList.remove("dom-update-highlight");
158 next();
163 </script>
164 </head>
166 <body onload="runTest()">
168 Tests DOM update highlights in the DOM tree.
169 </p>
171 <div id="container">
172 <div id="attrTest" attrFoo="foo"></div>
173 <div id="childTest"></div>
174 <div id="textTest"></div>
175 </div>
177 </body>
178 </html>