michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: michael@0: ok(window.Scratchpad, "Scratchpad variable exists"); michael@0: michael@0: openScratchpad(runTests); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html,initialization test for Scratchpad"; michael@0: } michael@0: michael@0: function runTests() michael@0: { michael@0: let sp = gScratchpadWindow.Scratchpad; michael@0: ok(sp, "Scratchpad object exists in new window"); michael@0: is(typeof sp.run, "function", "Scratchpad.run() exists"); michael@0: is(typeof sp.inspect, "function", "Scratchpad.inspect() exists"); michael@0: is(typeof sp.display, "function", "Scratchpad.display() exists"); michael@0: michael@0: let environmentMenu = gScratchpadWindow.document. michael@0: getElementById("sp-environment-menu"); michael@0: ok(environmentMenu, "Environment menu element exists"); michael@0: ok(environmentMenu.hasAttribute("hidden"), michael@0: "Environment menu is not visible"); michael@0: michael@0: let errorConsoleCommand = gScratchpadWindow.document. michael@0: getElementById("sp-cmd-errorConsole"); michael@0: ok(errorConsoleCommand, "Error console command element exists"); michael@0: is(errorConsoleCommand.getAttribute("disabled"), "true", michael@0: "Error console command is disabled"); michael@0: michael@0: let chromeContextCommand = gScratchpadWindow.document. michael@0: getElementById("sp-cmd-browserContext"); michael@0: ok(chromeContextCommand, "Chrome context command element exists"); michael@0: is(chromeContextCommand.getAttribute("disabled"), "true", michael@0: "Chrome context command is disabled"); michael@0: michael@0: finish(); michael@0: }