Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | // Test the webconsole output for various types of DOM Nodes. |
michael@0 | 7 | |
michael@0 | 8 | const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-dom-elements.html"; |
michael@0 | 9 | |
michael@0 | 10 | let inputTests = [ |
michael@0 | 11 | { |
michael@0 | 12 | input: "testBodyNode()", |
michael@0 | 13 | output: '<body id="body-id" class="body-class">', |
michael@0 | 14 | printOutput: "[object HTMLBodyElement]", |
michael@0 | 15 | inspectable: true, |
michael@0 | 16 | noClick: true, |
michael@0 | 17 | inspectorIcon: true |
michael@0 | 18 | }, |
michael@0 | 19 | |
michael@0 | 20 | { |
michael@0 | 21 | input: "testDocumentElement()", |
michael@0 | 22 | output: '<html lang="en-US" dir="ltr">', |
michael@0 | 23 | printOutput: "[object HTMLHtmlElement]", |
michael@0 | 24 | inspectable: true, |
michael@0 | 25 | noClick: true, |
michael@0 | 26 | inspectorIcon: true |
michael@0 | 27 | }, |
michael@0 | 28 | |
michael@0 | 29 | { |
michael@0 | 30 | input: "testDocument()", |
michael@0 | 31 | output: 'HTMLDocument \u2192 ' + TEST_URI, |
michael@0 | 32 | printOutput: "[object HTMLDocument]", |
michael@0 | 33 | inspectable: true, |
michael@0 | 34 | noClick: true, |
michael@0 | 35 | inspectorIcon: false |
michael@0 | 36 | }, |
michael@0 | 37 | |
michael@0 | 38 | { |
michael@0 | 39 | input: "testNode()", |
michael@0 | 40 | output: '<p some-attribute="some-value">', |
michael@0 | 41 | printOutput: "[object HTMLParagraphElement]", |
michael@0 | 42 | inspectable: true, |
michael@0 | 43 | noClick: true, |
michael@0 | 44 | inspectorIcon: true |
michael@0 | 45 | }, |
michael@0 | 46 | |
michael@0 | 47 | { |
michael@0 | 48 | input: "testNodeList()", |
michael@0 | 49 | output: 'NodeList [ <html>, <head>, <meta>, <title>, <body#body-id.body-class>, <p>, <iframe>, <div.some.classname.here.with.more.classnames.here>, <script> ]', |
michael@0 | 50 | printOutput: "[object NodeList]", |
michael@0 | 51 | inspectable: true, |
michael@0 | 52 | noClick: true, |
michael@0 | 53 | inspectorIcon: true |
michael@0 | 54 | }, |
michael@0 | 55 | |
michael@0 | 56 | { |
michael@0 | 57 | input: "testNodeInIframe()", |
michael@0 | 58 | output: '<p>', |
michael@0 | 59 | printOutput: "[object HTMLParagraphElement]", |
michael@0 | 60 | inspectable: true, |
michael@0 | 61 | noClick: true, |
michael@0 | 62 | inspectorIcon: true |
michael@0 | 63 | }, |
michael@0 | 64 | |
michael@0 | 65 | { |
michael@0 | 66 | input: "testDocumentFragment()", |
michael@0 | 67 | output: 'DocumentFragment [ <span.foo>, <div#fragdiv> ]', |
michael@0 | 68 | printOutput: "[object DocumentFragment]", |
michael@0 | 69 | inspectable: true, |
michael@0 | 70 | noClick: true, |
michael@0 | 71 | inspectorIcon: false |
michael@0 | 72 | }, |
michael@0 | 73 | |
michael@0 | 74 | { |
michael@0 | 75 | input: "testNodeInDocumentFragment()", |
michael@0 | 76 | output: '<span class="foo" data-lolz="hehe">', |
michael@0 | 77 | printOutput: "[object HTMLSpanElement]", |
michael@0 | 78 | inspectable: true, |
michael@0 | 79 | noClick: true, |
michael@0 | 80 | inspectorIcon: false |
michael@0 | 81 | }, |
michael@0 | 82 | |
michael@0 | 83 | { |
michael@0 | 84 | input: "testUnattachedNode()", |
michael@0 | 85 | output: '<p class="such-class" data-data="such-data">', |
michael@0 | 86 | printOutput: "[object HTMLParagraphElement]", |
michael@0 | 87 | inspectable: true, |
michael@0 | 88 | noClick: true, |
michael@0 | 89 | inspectorIcon: false |
michael@0 | 90 | } |
michael@0 | 91 | ]; |
michael@0 | 92 | |
michael@0 | 93 | function test() { |
michael@0 | 94 | Task.spawn(function*() { |
michael@0 | 95 | let {tab} = yield loadTab(TEST_URI); |
michael@0 | 96 | let hud = yield openConsole(tab); |
michael@0 | 97 | yield checkOutputForInputs(hud, inputTests); |
michael@0 | 98 | }).then(finishTest); |
michael@0 | 99 | } |