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 objects. michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-03.html"; michael@0: michael@0: let inputTests = [ michael@0: // 0 michael@0: { michael@0: input: "document", michael@0: output: "HTMLDocument \u2192 " + TEST_URI, michael@0: printOutput: "[object HTMLDocument]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: }, michael@0: michael@0: // 1 michael@0: { michael@0: input: "window", michael@0: output: "Window \u2192 " + TEST_URI, michael@0: printOutput: "[object Window", michael@0: inspectable: true, michael@0: noClick: true, michael@0: }, michael@0: michael@0: // 2 michael@0: { michael@0: input: "document.body", michael@0: output: "", michael@0: printOutput: "[object HTMLBodyElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: }, michael@0: michael@0: // 3 michael@0: { michael@0: input: "document.body.dataset", michael@0: output: "DOMStringMap { }", michael@0: printOutput: "[object DOMStringMap]", michael@0: inspectable: true, michael@0: variablesViewLabel: "DOMStringMap[0]", michael@0: }, michael@0: michael@0: // 4 michael@0: { michael@0: input: "document.body.classList", michael@0: output: "DOMTokenList [ ]", michael@0: printOutput: '""', michael@0: inspectable: true, michael@0: variablesViewLabel: "DOMTokenList[0]", michael@0: }, michael@0: michael@0: // 5 michael@0: { michael@0: input: "window.location.href", michael@0: output: '"' + TEST_URI + '"', michael@0: }, michael@0: michael@0: // 6 michael@0: { michael@0: input: "window.location", michael@0: output: "Location \u2192 " + TEST_URI, michael@0: printOutput: TEST_URI, michael@0: inspectable: true, michael@0: variablesViewLabel: "Location \u2192 test-console-output-03.html", michael@0: }, michael@0: michael@0: // 7 michael@0: { michael@0: input: "document.body.attributes", michael@0: output: "MozNamedAttrMap [ ]", michael@0: printOutput: "[object MozNamedAttrMap]", michael@0: inspectable: true, michael@0: variablesViewLabel: "MozNamedAttrMap[0]", michael@0: }, michael@0: michael@0: // 8 michael@0: { michael@0: input: "document.styleSheets", michael@0: output: "StyleSheetList [ ]", michael@0: printOutput: "[object StyleSheetList", michael@0: inspectable: true, michael@0: variablesViewLabel: "StyleSheetList[0]", michael@0: }, michael@0: michael@0: // 9 michael@0: { michael@0: input: "testBodyClassName()", michael@0: output: '', michael@0: printOutput: "[object HTMLBodyElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: }, michael@0: michael@0: // 10 michael@0: { michael@0: input: "testBodyID()", michael@0: output: '', michael@0: printOutput: "[object HTMLBodyElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: }, michael@0: michael@0: // 11 michael@0: { michael@0: input: "document.body.classList", michael@0: output: 'DOMTokenList [ "test1", "tezt2" ]', michael@0: printOutput: '"test1 tezt2"', michael@0: inspectable: true, michael@0: variablesViewLabel: "DOMTokenList[2]", michael@0: }, michael@0: michael@0: // 12 michael@0: { michael@0: input: "testBodyDataset()", michael@0: output: '', michael@0: printOutput: "[object HTMLBodyElement]", michael@0: inspectable: true, michael@0: noClick: true, michael@0: }, michael@0: michael@0: // 13 michael@0: { michael@0: input: "document.body.dataset", michael@0: output: 'DOMStringMap { preview: "zuzu"foo" }', michael@0: printOutput: "[object DOMStringMap]", michael@0: inspectable: true, michael@0: variablesViewLabel: "DOMStringMap[1]", michael@0: }, michael@0: michael@0: // 14 michael@0: { michael@0: input: "document.body.attributes", michael@0: output: 'MozNamedAttrMap [ class="test1 tezt2", id="foobarid", ' + michael@0: 'data-preview="zuzu"<a>foo" ]', michael@0: printOutput: "[object MozNamedAttrMap]", michael@0: inspectable: true, michael@0: variablesViewLabel: "MozNamedAttrMap[3]", michael@0: }, michael@0: michael@0: // 15 michael@0: { michael@0: input: "document.body.attributes[0]", michael@0: output: 'class="test1 tezt2"', michael@0: printOutput: "[object Attr]", michael@0: inspectable: true, michael@0: variablesViewLabel: 'class="test1 tezt2"', michael@0: }, michael@0: ]; michael@0: michael@0: function test() { michael@0: requestLongerTimeout(2); michael@0: Task.spawn(function*() { michael@0: const {tab} = yield loadTab(TEST_URI); michael@0: const hud = yield openConsole(tab); michael@0: yield checkOutputForInputs(hud, inputTests); michael@0: inputTests = null; michael@0: }).then(finishTest); michael@0: }