michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Test the webconsole output for various types of DOM Nodes. michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-dom-elements.html"; michael@0: michael@0: let inputTests = [ michael@0: { michael@0: input: "testBodyNode()", michael@0: output: '', michael@0: printOutput: "[object HTMLBodyElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: true michael@0: }, michael@0: michael@0: { michael@0: input: "testDocumentElement()", michael@0: output: '', michael@0: printOutput: "[object HTMLHtmlElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: true michael@0: }, michael@0: michael@0: { michael@0: input: "testDocument()", michael@0: output: 'HTMLDocument \u2192 ' + TEST_URI, michael@0: printOutput: "[object HTMLDocument]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: false michael@0: }, michael@0: michael@0: { michael@0: input: "testNode()", michael@0: output: '

', michael@0: printOutput: "[object HTMLParagraphElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: true michael@0: }, michael@0: michael@0: { michael@0: input: "testNodeList()", michael@0: output: 'NodeList [ , , , , <body#body-id.body-class>, <p>, <iframe>, <div.some.classname.here.with.more.classnames.here>, <script> ]', michael@0: printOutput: "[object NodeList]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: true michael@0: }, michael@0: michael@0: { michael@0: input: "testNodeInIframe()", michael@0: output: '<p>', michael@0: printOutput: "[object HTMLParagraphElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: true michael@0: }, michael@0: michael@0: { michael@0: input: "testDocumentFragment()", michael@0: output: 'DocumentFragment [ <span.foo>, <div#fragdiv> ]', michael@0: printOutput: "[object DocumentFragment]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: false michael@0: }, michael@0: michael@0: { michael@0: input: "testNodeInDocumentFragment()", michael@0: output: '<span class="foo" data-lolz="hehe">', michael@0: printOutput: "[object HTMLSpanElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: false michael@0: }, michael@0: michael@0: { michael@0: input: "testUnattachedNode()", michael@0: output: '<p class="such-class" data-data="such-data">', michael@0: printOutput: "[object HTMLParagraphElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: inspectorIcon: false michael@0: } michael@0: ]; michael@0: michael@0: function test() { michael@0: Task.spawn(function*() { michael@0: let {tab} = yield loadTab(TEST_URI); michael@0: let hud = yield openConsole(tab); michael@0: yield checkOutputForInputs(hud, inputTests); michael@0: }).then(finishTest); michael@0: }