browser/devtools/debugger/test/browser_dbg_pretty-print-12.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 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Make sure that we don't leave the pretty print button checked when we fail to
michael@0 6 * pretty print a source (because it isn't a JS file, for example).
michael@0 7 */
michael@0 8
michael@0 9 const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
michael@0 10
michael@0 11 let gTab, gDebuggee, gPanel, gDebugger;
michael@0 12 let gEditor, gSources;
michael@0 13
michael@0 14 function test() {
michael@0 15 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
michael@0 16 gTab = aTab;
michael@0 17 gDebuggee = aDebuggee;
michael@0 18 gPanel = aPanel;
michael@0 19 gDebugger = gPanel.panelWin;
michael@0 20 gEditor = gDebugger.DebuggerView.editor;
michael@0 21 gSources = gDebugger.DebuggerView.Sources;
michael@0 22
michael@0 23 waitForSourceShown(gPanel, "")
michael@0 24 .then(() => {
michael@0 25 let shown = ensureSourceIs(gPanel, TAB_URL, true)
michael@0 26 gSources.selectedValue = TAB_URL;
michael@0 27 return shown;
michael@0 28 })
michael@0 29 .then(clickPrettyPrintButton)
michael@0 30 .then(testButtonIsntChecked)
michael@0 31 .then(() => closeDebuggerAndFinish(gPanel))
michael@0 32 .then(null, aError => {
michael@0 33 ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
michael@0 34 });
michael@0 35 });
michael@0 36 }
michael@0 37
michael@0 38 function clickPrettyPrintButton() {
michael@0 39 gDebugger.document.getElementById("pretty-print").click();
michael@0 40 }
michael@0 41
michael@0 42 function testButtonIsntChecked() {
michael@0 43 is(gDebugger.document.getElementById("pretty-print").checked, false,
michael@0 44 "The button shouldn't be checked after trying to pretty print a non-js file.");
michael@0 45 }
michael@0 46
michael@0 47 registerCleanupFunction(function() {
michael@0 48 gTab = null;
michael@0 49 gDebuggee = null;
michael@0 50 gPanel = null;
michael@0 51 gDebugger = null;
michael@0 52 gEditor = null;
michael@0 53 gSources = null;
michael@0 54 });

mercurial