browser/devtools/scratchpad/test/browser_scratchpad_initialization.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 2 /* Any copyright is dedicated to the Public Domain.
michael@0 3 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 4
michael@0 5 function test()
michael@0 6 {
michael@0 7 waitForExplicitFinish();
michael@0 8
michael@0 9 gBrowser.selectedTab = gBrowser.addTab();
michael@0 10 gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
michael@0 11 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
michael@0 12
michael@0 13 ok(window.Scratchpad, "Scratchpad variable exists");
michael@0 14
michael@0 15 openScratchpad(runTests);
michael@0 16 }, true);
michael@0 17
michael@0 18 content.location = "data:text/html,initialization test for Scratchpad";
michael@0 19 }
michael@0 20
michael@0 21 function runTests()
michael@0 22 {
michael@0 23 let sp = gScratchpadWindow.Scratchpad;
michael@0 24 ok(sp, "Scratchpad object exists in new window");
michael@0 25 is(typeof sp.run, "function", "Scratchpad.run() exists");
michael@0 26 is(typeof sp.inspect, "function", "Scratchpad.inspect() exists");
michael@0 27 is(typeof sp.display, "function", "Scratchpad.display() exists");
michael@0 28
michael@0 29 let environmentMenu = gScratchpadWindow.document.
michael@0 30 getElementById("sp-environment-menu");
michael@0 31 ok(environmentMenu, "Environment menu element exists");
michael@0 32 ok(environmentMenu.hasAttribute("hidden"),
michael@0 33 "Environment menu is not visible");
michael@0 34
michael@0 35 let errorConsoleCommand = gScratchpadWindow.document.
michael@0 36 getElementById("sp-cmd-errorConsole");
michael@0 37 ok(errorConsoleCommand, "Error console command element exists");
michael@0 38 is(errorConsoleCommand.getAttribute("disabled"), "true",
michael@0 39 "Error console command is disabled");
michael@0 40
michael@0 41 let chromeContextCommand = gScratchpadWindow.document.
michael@0 42 getElementById("sp-cmd-browserContext");
michael@0 43 ok(chromeContextCommand, "Chrome context command element exists");
michael@0 44 is(chromeContextCommand.getAttribute("disabled"), "true",
michael@0 45 "Chrome context command is disabled");
michael@0 46
michael@0 47 finish();
michael@0 48 }

mercurial