1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/scratchpad/test/browser_scratchpad_falsy.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 +/* Bug 679467 */ 1.8 + 1.9 +function test() 1.10 +{ 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + gBrowser.selectedTab = gBrowser.addTab(); 1.14 + gBrowser.selectedBrowser.addEventListener("load", function onLoad() { 1.15 + gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); 1.16 + openScratchpad(testFalsy); 1.17 + }, true); 1.18 + 1.19 + content.location = "data:text/html,<p>test falsy display() values in Scratchpad"; 1.20 +} 1.21 + 1.22 +function testFalsy() 1.23 +{ 1.24 + let scratchpad = gScratchpadWindow.Scratchpad; 1.25 + verifyFalsies(scratchpad).then(function() { 1.26 + scratchpad.setBrowserContext(); 1.27 + verifyFalsies(scratchpad).then(finish); 1.28 + }); 1.29 +} 1.30 + 1.31 + 1.32 +function verifyFalsies(scratchpad) 1.33 +{ 1.34 + let tests = [{ 1.35 + method: "display", 1.36 + code: "undefined", 1.37 + result: "undefined\n/*\nundefined\n*/", 1.38 + label: "undefined is displayed" 1.39 + }, 1.40 + { 1.41 + method: "display", 1.42 + code: "false", 1.43 + result: "false\n/*\nfalse\n*/", 1.44 + label: "false is displayed" 1.45 + }, 1.46 + { 1.47 + method: "display", 1.48 + code: "0", 1.49 + result: "0\n/*\n0\n*/", 1.50 + label: "0 is displayed" 1.51 + }, 1.52 + { 1.53 + method: "display", 1.54 + code: "null", 1.55 + result: "null\n/*\nnull\n*/", 1.56 + label: "null is displayed" 1.57 + }, 1.58 + { 1.59 + method: "display", 1.60 + code: "NaN", 1.61 + result: "NaN\n/*\nNaN\n*/", 1.62 + label: "NaN is displayed" 1.63 + }, 1.64 + { 1.65 + method: "display", 1.66 + code: "''", 1.67 + result: "''\n/*\n\n*/", 1.68 + label: "the empty string is displayed" 1.69 + }]; 1.70 + 1.71 + return runAsyncTests(scratchpad, tests); 1.72 +}