browser/devtools/scratchpad/test/browser_scratchpad_falsy.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

     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