browser/devtools/debugger/test/browser_dbg_pretty-print-12.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:dbeaebb5489f
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
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 */
8
9 const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
10
11 let gTab, gDebuggee, gPanel, gDebugger;
12 let gEditor, gSources;
13
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;
22
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 }
37
38 function clickPrettyPrintButton() {
39 gDebugger.document.getElementById("pretty-print").click();
40 }
41
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 }
46
47 registerCleanupFunction(function() {
48 gTab = null;
49 gDebuggee = null;
50 gPanel = null;
51 gDebugger = null;
52 gEditor = null;
53 gSources = null;
54 });

mercurial