|
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 */ |
|
5 |
|
6 function test() |
|
7 { |
|
8 waitForExplicitFinish(); |
|
9 |
|
10 gBrowser.selectedTab = gBrowser.addTab(); |
|
11 gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
|
12 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
|
13 openScratchpad(testFalsy); |
|
14 }, true); |
|
15 |
|
16 content.location = "data:text/html,<p>test falsy display() values in Scratchpad"; |
|
17 } |
|
18 |
|
19 function testFalsy() |
|
20 { |
|
21 let scratchpad = gScratchpadWindow.Scratchpad; |
|
22 verifyFalsies(scratchpad).then(function() { |
|
23 scratchpad.setBrowserContext(); |
|
24 verifyFalsies(scratchpad).then(finish); |
|
25 }); |
|
26 } |
|
27 |
|
28 |
|
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 }]; |
|
67 |
|
68 return runAsyncTests(scratchpad, tests); |
|
69 } |