mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
30b2b7ce44
For simple rules like function spacing, we can auto-fix these across the code base so they are followed in a consistent way. To generate this patch, I ran: ./mach eslint devtools --no-ignore --fix After this, I reverted any changes to third party files that we really do want to ignore. MozReview-Commit-ID: 6Q8BApkAW20
169 lines
3.7 KiB
JavaScript
169 lines
3.7 KiB
JavaScript
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
// Test the webconsole output for various types of objects.
|
|
|
|
"use strict";
|
|
|
|
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
|
"test/test-console-output-03.html";
|
|
|
|
var 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 + '"',
|
|
noClick: true,
|
|
},
|
|
|
|
// 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: "NamedNodeMap [ ]",
|
|
printOutput: "[object NamedNodeMap]",
|
|
inspectable: true,
|
|
variablesViewLabel: "NamedNodeMap[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: 'NamedNodeMap [ class="test1 tezt2", id="foobarid", ' +
|
|
'data-preview="zuzu"<a>foo" ]',
|
|
printOutput: "[object NamedNodeMap]",
|
|
inspectable: true,
|
|
variablesViewLabel: "NamedNodeMap[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);
|
|
}
|