browser_webconsole_console_table_fallback.js (1387B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // console.table fallback to console.log for unsupported parameters. 6 7 "use strict"; 8 9 const tests = [ 10 [`console.table(10, 20, 30, 40, 50)`, `10 20 30 40 50`], 11 [`console.table(1.2, 3.4, 5.6)`, `1.2 3.4 5.6`], 12 [`console.table(10n, 20n, 30n)`, `10n 20n 30n`], 13 [`console.table(true, false)`, `true false`], 14 [`console.table("foo", "bar", "baz")`, `foo bar baz`], 15 [`console.table(null, undefined, null)`, `null undefined null`], 16 [`console.table(undefined, null, undefined)`, `undefined null undefined`], 17 [`console.table(Symbol.iterator)`, `Symbol(Symbol.iterator)`], 18 [`console.table(/pattern/i)`, `/pattern/i`], 19 [`console.table(function f() {})`, `function f()`], 20 ]; 21 22 add_task(async function () { 23 const TEST_URI = "data:text/html,<!DOCTYPE html><meta charset=utf8>"; 24 25 const hud = await openNewTabAndConsole(TEST_URI); 26 27 for (const [input, output] of tests) { 28 execute(hud, input); 29 const message = await waitFor( 30 () => findConsoleAPIMessage(hud, output), 31 `Waiting for output for ${input}` 32 ); 33 34 is( 35 message.querySelector(".message-body").textContent, 36 output, 37 `Expected messages are displayed for ${input}` 38 ); 39 } 40 });