browser/devtools/webconsole/test/browser_webconsole_output_05.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 4 */
michael@0 5
michael@0 6 // Test the webconsole output for various types of objects.
michael@0 7
michael@0 8 const TEST_URI = "data:text/html;charset=utf8,test for console output - 05";
michael@0 9
michael@0 10 let dateNow = Date.now();
michael@0 11
michael@0 12 let inputTests = [
michael@0 13 // 0
michael@0 14 {
michael@0 15 input: "/foo?b*\\s\"ar/igym",
michael@0 16 output: "/foo?b*\\s\"ar/gimy",
michael@0 17 printOutput: "/foo?b*\\s\"ar/gimy",
michael@0 18 inspectable: true,
michael@0 19 },
michael@0 20
michael@0 21 // 1
michael@0 22 {
michael@0 23 input: "null",
michael@0 24 output: "null",
michael@0 25 },
michael@0 26
michael@0 27 // 2
michael@0 28 {
michael@0 29 input: "undefined",
michael@0 30 output: "undefined",
michael@0 31 },
michael@0 32
michael@0 33 // 3
michael@0 34 {
michael@0 35 input: "true",
michael@0 36 output: "true",
michael@0 37 },
michael@0 38
michael@0 39 // 4
michael@0 40 {
michael@0 41 input: "new Boolean(false)",
michael@0 42 output: "false",
michael@0 43 inspectable: true,
michael@0 44 },
michael@0 45
michael@0 46 // 5
michael@0 47 {
michael@0 48 input: "new Date(" + dateNow + ")",
michael@0 49 output: "Date " + (new Date(dateNow)).toISOString(),
michael@0 50 printOutput: (new Date(dateNow)).toString(),
michael@0 51 inspectable: true,
michael@0 52 },
michael@0 53
michael@0 54 // 6
michael@0 55 {
michael@0 56 input: "new Date('test')",
michael@0 57 output: "Invalid Date",
michael@0 58 printOutput: "Invalid Date",
michael@0 59 inspectable: true,
michael@0 60 variablesViewLabel: "Invalid Date",
michael@0 61 },
michael@0 62
michael@0 63 // 7
michael@0 64 {
michael@0 65 input: "new Number(43)",
michael@0 66 output: "43",
michael@0 67 inspectable: true,
michael@0 68 },
michael@0 69
michael@0 70 // 8
michael@0 71 {
michael@0 72 input: "new String('hello world')",
michael@0 73 output: '"hello world"',
michael@0 74 inspectable: true,
michael@0 75 },
michael@0 76 ];
michael@0 77
michael@0 78 function test() {
michael@0 79 Task.spawn(function*() {
michael@0 80 let {tab} = yield loadTab(TEST_URI);
michael@0 81 let hud = yield openConsole(tab);
michael@0 82 return checkOutputForInputs(hud, inputTests);
michael@0 83 }).then(finishUp);
michael@0 84 }
michael@0 85
michael@0 86 function finishUp() {
michael@0 87 inputTests = null;
michael@0 88 finishTest();
michael@0 89 }

mercurial