1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test the webconsole output for various types of objects.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-03.html";
let inputTests = [
// 0
{
input: "document",
output: "HTMLDocument \u2192 " + TEST_URI,
printOutput: "[object HTMLDocument]",
inspectable: true,
noClick: true,
},
// 1
{
input: "window",
output: "Window \u2192 " + TEST_URI,
printOutput: "[object Window",
inspectable: true,
noClick: true,
},
// 2
{
input: "document.body",
output: "<body>",
printOutput: "[object HTMLBodyElement]",
inspectable: true,
noClick: true,
},
// 3
{
input: "document.body.dataset",
output: "DOMStringMap { }",
printOutput: "[object DOMStringMap]",
inspectable: true,
variablesViewLabel: "DOMStringMap[0]",
},
// 4
{
input: "document.body.classList",
output: "DOMTokenList [ ]",
printOutput: '""',
inspectable: true,
variablesViewLabel: "DOMTokenList[0]",
},
// 5
{
input: "window.location.href",
output: '"' + TEST_URI + '"',
},
// 6
{
input: "window.location",
output: "Location \u2192 " + TEST_URI,
printOutput: TEST_URI,
inspectable: true,
variablesViewLabel: "Location \u2192 test-console-output-03.html",
},
// 7
{
input: "document.body.attributes",
output: "MozNamedAttrMap [ ]",
printOutput: "[object MozNamedAttrMap]",
inspectable: true,
variablesViewLabel: "MozNamedAttrMap[0]",
},
// 8
{
input: "document.styleSheets",
output: "StyleSheetList [ ]",
printOutput: "[object StyleSheetList",
inspectable: true,
variablesViewLabel: "StyleSheetList[0]",
},
// 9
{
input: "testBodyClassName()",
output: '<body class="test1 tezt2">',
printOutput: "[object HTMLBodyElement]",
inspectable: true,
noClick: true,
},
// 10
{
input: "testBodyID()",
output: '<body class="test1 tezt2" id="foobarid">',
printOutput: "[object HTMLBodyElement]",
inspectable: true,
noClick: true,
},
// 11
{
input: "document.body.classList",
output: 'DOMTokenList [ "test1", "tezt2" ]',
printOutput: '"test1 tezt2"',
inspectable: true,
variablesViewLabel: "DOMTokenList[2]",
},
// 12
{
input: "testBodyDataset()",
output: '<body class="test1 tezt2" id="foobarid"' +
' data-preview="zuzu"<a>foo">',
printOutput: "[object HTMLBodyElement]",
inspectable: true,
noClick: true,
},
// 13
{
input: "document.body.dataset",
output: 'DOMStringMap { preview: "zuzu"<a>foo" }',
printOutput: "[object DOMStringMap]",
inspectable: true,
variablesViewLabel: "DOMStringMap[1]",
},
// 14
{
input: "document.body.attributes",
output: 'MozNamedAttrMap [ class="test1 tezt2", id="foobarid", ' +
'data-preview="zuzu"<a>foo" ]',
printOutput: "[object MozNamedAttrMap]",
inspectable: true,
variablesViewLabel: "MozNamedAttrMap[3]",
},
// 15
{
input: "document.body.attributes[0]",
output: 'class="test1 tezt2"',
printOutput: "[object Attr]",
inspectable: true,
variablesViewLabel: 'class="test1 tezt2"',
},
];
function test() {
requestLongerTimeout(2);
Task.spawn(function*() {
const {tab} = yield loadTab(TEST_URI);
const hud = yield openConsole(tab);
yield checkOutputForInputs(hud, inputTests);
inputTests = null;
}).then(finishTest);
}
|