browser/devtools/scratchpad/test/browser_scratchpad_falsy.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* vim: set ts=2 et sw=2 tw=80: */
     2 /* Any copyright is dedicated to the Public Domain.
     3    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /* Bug 679467 */
     6 function test()
     7 {
     8   waitForExplicitFinish();
    10   gBrowser.selectedTab = gBrowser.addTab();
    11   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
    12     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
    13     openScratchpad(testFalsy);
    14   }, true);
    16   content.location = "data:text/html,<p>test falsy display() values in Scratchpad";
    17 }
    19 function testFalsy()
    20 {
    21   let scratchpad = gScratchpadWindow.Scratchpad;
    22   verifyFalsies(scratchpad).then(function() {
    23     scratchpad.setBrowserContext();
    24     verifyFalsies(scratchpad).then(finish);
    25   });
    26 }
    29 function verifyFalsies(scratchpad)
    30 {
    31   let tests = [{
    32     method: "display",
    33     code: "undefined",
    34     result: "undefined\n/*\nundefined\n*/",
    35     label: "undefined is displayed"
    36   },
    37   {
    38     method: "display",
    39     code: "false",
    40     result: "false\n/*\nfalse\n*/",
    41     label: "false is displayed"
    42   },
    43   {
    44     method: "display",
    45     code: "0",
    46     result: "0\n/*\n0\n*/",
    47     label: "0 is displayed"
    48   },
    49   {
    50     method: "display",
    51     code: "null",
    52     result: "null\n/*\nnull\n*/",
    53     label: "null is displayed"
    54   },
    55   {
    56     method: "display",
    57     code: "NaN",
    58     result: "NaN\n/*\nNaN\n*/",
    59     label: "NaN is displayed"
    60   },
    61   {
    62     method: "display",
    63     code: "''",
    64     result: "''\n/*\n\n*/",
    65     label: "the empty string is displayed"
    66   }];
    68   return runAsyncTests(scratchpad, tests);
    69 }

mercurial