|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Make sure the right text shows when the page has no sources. |
|
6 */ |
|
7 |
|
8 const TAB_URL = EXAMPLE_URL + "doc_no-page-sources.html"; |
|
9 |
|
10 let gTab, gDebuggee, gPanel, gDebugger; |
|
11 let gEditor, gSources; |
|
12 |
|
13 function test() { |
|
14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
|
15 gTab = aTab; |
|
16 gDebuggee = aDebuggee; |
|
17 gPanel = aPanel; |
|
18 gDebugger = gPanel.panelWin; |
|
19 gEditor = gDebugger.DebuggerView.editor; |
|
20 gSources = gDebugger.DebuggerView.Sources; |
|
21 |
|
22 reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCES_ADDED) |
|
23 .then(testSourcesEmptyText) |
|
24 .then(() => closeDebuggerAndFinish(gPanel)) |
|
25 .then(null, aError => { |
|
26 ok(false, "Got an error: " + aError.message + "\n" + aError.stack); |
|
27 }); |
|
28 }); |
|
29 } |
|
30 |
|
31 function testSourcesEmptyText() { |
|
32 is(gSources.itemCount, 0, |
|
33 "Found no entries in the sources widget."); |
|
34 |
|
35 is(gEditor.getText().length, 0, |
|
36 "The source editor should not have any text displayed."); |
|
37 |
|
38 is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-text").getAttribute("value"), |
|
39 gDebugger.L10N.getStr("noSourcesText"), |
|
40 "The sources widget should now display 'This page has no sources'."); |
|
41 } |
|
42 |
|
43 registerCleanupFunction(function() { |
|
44 gTab = null; |
|
45 gDebuggee = null; |
|
46 gPanel = null; |
|
47 gDebugger = null; |
|
48 gEditor = null; |
|
49 gSources = null; |
|
50 }); |