browser/devtools/webconsole/test/browser_webconsole_output_dom_elements_01.js

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

mercurial