|
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 |
|
5 function test() |
|
6 { |
|
7 waitForExplicitFinish(); |
|
8 |
|
9 gBrowser.selectedTab = gBrowser.addTab(); |
|
10 gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
|
11 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
|
12 |
|
13 ok(window.Scratchpad, "Scratchpad variable exists"); |
|
14 |
|
15 openScratchpad(runTests); |
|
16 }, true); |
|
17 |
|
18 content.location = "data:text/html,initialization test for Scratchpad"; |
|
19 } |
|
20 |
|
21 function runTests() |
|
22 { |
|
23 let sp = gScratchpadWindow.Scratchpad; |
|
24 ok(sp, "Scratchpad object exists in new window"); |
|
25 is(typeof sp.run, "function", "Scratchpad.run() exists"); |
|
26 is(typeof sp.inspect, "function", "Scratchpad.inspect() exists"); |
|
27 is(typeof sp.display, "function", "Scratchpad.display() exists"); |
|
28 |
|
29 let environmentMenu = gScratchpadWindow.document. |
|
30 getElementById("sp-environment-menu"); |
|
31 ok(environmentMenu, "Environment menu element exists"); |
|
32 ok(environmentMenu.hasAttribute("hidden"), |
|
33 "Environment menu is not visible"); |
|
34 |
|
35 let errorConsoleCommand = gScratchpadWindow.document. |
|
36 getElementById("sp-cmd-errorConsole"); |
|
37 ok(errorConsoleCommand, "Error console command element exists"); |
|
38 is(errorConsoleCommand.getAttribute("disabled"), "true", |
|
39 "Error console command is disabled"); |
|
40 |
|
41 let chromeContextCommand = gScratchpadWindow.document. |
|
42 getElementById("sp-cmd-browserContext"); |
|
43 ok(chromeContextCommand, "Chrome context command element exists"); |
|
44 is(chromeContextCommand.getAttribute("disabled"), "true", |
|
45 "Chrome context command is disabled"); |
|
46 |
|
47 finish(); |
|
48 } |