1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 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 + 1.8 +function test() 1.9 +{ 1.10 + waitForExplicitFinish(); 1.11 + 1.12 + gBrowser.selectedTab = gBrowser.addTab(); 1.13 + gBrowser.selectedBrowser.addEventListener("load", function onLoad() { 1.14 + gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); 1.15 + 1.16 + ok(window.Scratchpad, "Scratchpad variable exists"); 1.17 + 1.18 + openScratchpad(runTests); 1.19 + }, true); 1.20 + 1.21 + content.location = "data:text/html,initialization test for Scratchpad"; 1.22 +} 1.23 + 1.24 +function runTests() 1.25 +{ 1.26 + let sp = gScratchpadWindow.Scratchpad; 1.27 + ok(sp, "Scratchpad object exists in new window"); 1.28 + is(typeof sp.run, "function", "Scratchpad.run() exists"); 1.29 + is(typeof sp.inspect, "function", "Scratchpad.inspect() exists"); 1.30 + is(typeof sp.display, "function", "Scratchpad.display() exists"); 1.31 + 1.32 + let environmentMenu = gScratchpadWindow.document. 1.33 + getElementById("sp-environment-menu"); 1.34 + ok(environmentMenu, "Environment menu element exists"); 1.35 + ok(environmentMenu.hasAttribute("hidden"), 1.36 + "Environment menu is not visible"); 1.37 + 1.38 + let errorConsoleCommand = gScratchpadWindow.document. 1.39 + getElementById("sp-cmd-errorConsole"); 1.40 + ok(errorConsoleCommand, "Error console command element exists"); 1.41 + is(errorConsoleCommand.getAttribute("disabled"), "true", 1.42 + "Error console command is disabled"); 1.43 + 1.44 + let chromeContextCommand = gScratchpadWindow.document. 1.45 + getElementById("sp-cmd-browserContext"); 1.46 + ok(chromeContextCommand, "Chrome context command element exists"); 1.47 + is(chromeContextCommand.getAttribute("disabled"), "true", 1.48 + "Chrome context command is disabled"); 1.49 + 1.50 + finish(); 1.51 +}