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

Unified Diff: LayoutTests/inspector/elements/elements-css-path.html

Issue 75253002: DevTools: [Elements] Implement "Copy CSS Path" context menu item for elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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/elements-css-path.html
diff --git a/LayoutTests/inspector/elements/elements-css-path.html b/LayoutTests/inspector/elements/elements-css-path.html
new file mode 100644
index 0000000000000000000000000000000000000000..6d8bbbab0206249fc3f6658afb66d7429dde36c3
--- /dev/null
+++ b/LayoutTests/inspector/elements/elements-css-path.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js" id="script-id"></script>
+<script src="../../http/tests/inspector/elements-test.js"></script>
+<script id="test-script">
+function test()
+{
+ InspectorTest.expandElementsTree(dumpNodes.bind(null, ""));
+ var doc;
aandrey 2013/11/18 13:43:51 make this a local var of the function below
apavlov 2013/11/18 15:03:59 Done.
+
+ function dumpNodes(prefix, node)
+ {
+ if (!doc) {
+ doc = getDocumentElement();
+ node = doc;
+ }
+ if (node.getAttribute("id") === "test-script")
+ return;
+ if (node.nodeType() === Node.ELEMENT_NODE)
+ dumpNodeData(node, prefix);
+ var children = node.children();
+ for (var i = 0; children && i < children.length; ++i)
+ dumpNodes(prefix + " ", children[i]);
+ if (node === doc)
+ InspectorTest.completeTest();
+ }
+
+ function getDocumentElement()
+ {
+ var map = WebInspector.domAgent._idToDOMNode;
+ for (var id in map) {
+ if (map[id].nodeName() === "#document")
+ return map[id];
+ }
+
+ return null;
+ }
+
+ function dumpNodeData(node, prefix)
+ {
+ var result = prefix + node.cssPath(true);
aandrey 2013/11/18 13:43:51 can you also test that: (document.querySelectorAl
apavlov 2013/11/18 15:03:59 This condition is too weak. We should test that th
+ InspectorTest.addResult(result.replace(/\n/g, "\\n"));
+ }
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<p>Tests DOMNode.cssPath()</p>
+
+<article>First</article>
+<article>Second</article>
+
+<div class="foo bar">1</div>
+<div class="foo">2</div>
+<span class="bar">3</span>
+
+<div id="container">
+ <div>4</div>
+ <div>5</div>
+ <div id="inner-id">6</div>
+ <p>7</p>
+</div>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/elements-css-path-expected.txt » ('j') | Source/devtools/front_end/DOMAgent.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698