X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=LayoutTests%2Fhttp%2Ftests%2Finspector%2Felements-test.js;h=3e7f7c38e7ef973c8b8eaf23d2930f4e0ce8f3ce;hp=62486179edcd678bae8d260dcfa7ddffa6cb38b5;hb=5d2d124918d44a9e2e98805477ac2880812b041f;hpb=9cf3ea16bf345bb5d417d7085c4b4c6c3dcd7626 diff --git a/LayoutTests/http/tests/inspector/elements-test.js b/LayoutTests/http/tests/inspector/elements-test.js index 62486179edcd..3e7f7c38e7ef 100755 --- a/LayoutTests/http/tests/inspector/elements-test.js +++ b/LayoutTests/http/tests/inspector/elements-test.js @@ -1,9 +1,5 @@ var initialize_ElementTest = function() { -InspectorTest.pushAllDOM = function(callback) -{ - InspectorTest.nodeWithId(/nonstring/, callback); -} InspectorTest.nodeWithId = function(idValue, callback) { @@ -37,6 +33,17 @@ InspectorTest.nodeWithId = function(idValue, callback) WebInspector.domAgent.getChildNodesAsync(WebInspector.domAgent.document, processChildren.bind(this, true)); }; +InspectorTest.expandedNodeWithId = function(idValue) +{ + var result; + function callback(node) + { + result = node; + } + InspectorTest.nodeWithId(idValue, callback); + return result; +} + InspectorTest.selectNodeWithId = function(idValue, callback) { function mycallback(node) @@ -123,26 +130,77 @@ InspectorTest.dumpStyleTreeItem = function(treeItem, prefix, depth) } }; -InspectorTest.dumpElementsTree = function() +InspectorTest.dumpElementsTree = function(rootNode) { + function beautify(element) + { + return element.textContent.replace(/\u200b/g, "").replace(/\n/g, "").trim(); + } + + function print(treeItem, prefix) + { + if (treeItem.listItemElement) { + var expander; + if (treeItem.hasChildren) { + if (treeItem.expanded) + expander = "- "; + else + expander = "+ "; + } else + expander = " "; + + InspectorTest.addResult(prefix + expander + beautify(treeItem.listItemElement)); + } + + + if (!treeItem.expanded) + return; + + var children = treeItem.children; + for (var i = 0; children && i < children.length - 1; ++i) + print(children[i], prefix + " "); + + // Closing tag. + if (children && children.length) + print(children[children.length - 1], prefix); + } + WebInspector.panels.elements.updateModifiedNodes(); - InspectorTest.addResult(WebInspector.panels.elements.treeOutline.element.textContent.replace(/\u200b/g, "").replace(/\n/g, "").replace(/