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.

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

mercurial