1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_output_dom_elements_01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +/* 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 + 1.9 +// Test the webconsole output for various types of DOM Nodes. 1.10 + 1.11 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-dom-elements.html"; 1.12 + 1.13 +let inputTests = [ 1.14 + { 1.15 + input: "testBodyNode()", 1.16 + output: '<body id="body-id" class="body-class">', 1.17 + printOutput: "[object HTMLBodyElement]", 1.18 + inspectable: true, 1.19 + noClick: true, 1.20 + inspectorIcon: true 1.21 + }, 1.22 + 1.23 + { 1.24 + input: "testDocumentElement()", 1.25 + output: '<html lang="en-US" dir="ltr">', 1.26 + printOutput: "[object HTMLHtmlElement]", 1.27 + inspectable: true, 1.28 + noClick: true, 1.29 + inspectorIcon: true 1.30 + }, 1.31 + 1.32 + { 1.33 + input: "testDocument()", 1.34 + output: 'HTMLDocument \u2192 ' + TEST_URI, 1.35 + printOutput: "[object HTMLDocument]", 1.36 + inspectable: true, 1.37 + noClick: true, 1.38 + inspectorIcon: false 1.39 + }, 1.40 + 1.41 + { 1.42 + input: "testNode()", 1.43 + output: '<p some-attribute="some-value">', 1.44 + printOutput: "[object HTMLParagraphElement]", 1.45 + inspectable: true, 1.46 + noClick: true, 1.47 + inspectorIcon: true 1.48 + }, 1.49 + 1.50 + { 1.51 + input: "testNodeList()", 1.52 + output: 'NodeList [ <html>, <head>, <meta>, <title>, <body#body-id.body-class>, <p>, <iframe>, <div.some.classname.here.with.more.classnames.here>, <script> ]', 1.53 + printOutput: "[object NodeList]", 1.54 + inspectable: true, 1.55 + noClick: true, 1.56 + inspectorIcon: true 1.57 + }, 1.58 + 1.59 + { 1.60 + input: "testNodeInIframe()", 1.61 + output: '<p>', 1.62 + printOutput: "[object HTMLParagraphElement]", 1.63 + inspectable: true, 1.64 + noClick: true, 1.65 + inspectorIcon: true 1.66 + }, 1.67 + 1.68 + { 1.69 + input: "testDocumentFragment()", 1.70 + output: 'DocumentFragment [ <span.foo>, <div#fragdiv> ]', 1.71 + printOutput: "[object DocumentFragment]", 1.72 + inspectable: true, 1.73 + noClick: true, 1.74 + inspectorIcon: false 1.75 + }, 1.76 + 1.77 + { 1.78 + input: "testNodeInDocumentFragment()", 1.79 + output: '<span class="foo" data-lolz="hehe">', 1.80 + printOutput: "[object HTMLSpanElement]", 1.81 + inspectable: true, 1.82 + noClick: true, 1.83 + inspectorIcon: false 1.84 + }, 1.85 + 1.86 + { 1.87 + input: "testUnattachedNode()", 1.88 + output: '<p class="such-class" data-data="such-data">', 1.89 + printOutput: "[object HTMLParagraphElement]", 1.90 + inspectable: true, 1.91 + noClick: true, 1.92 + inspectorIcon: false 1.93 + } 1.94 +]; 1.95 + 1.96 +function test() { 1.97 + Task.spawn(function*() { 1.98 + let {tab} = yield loadTab(TEST_URI); 1.99 + let hud = yield openConsole(tab); 1.100 + yield checkOutputForInputs(hud, inputTests); 1.101 + }).then(finishTest); 1.102 +}