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

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

mercurial