browser/devtools/debugger/test/browser_dbg_no-page-sources.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_no-page-sources.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Make sure the right text shows when the page has no sources.
     1.9 + */
    1.10 +
    1.11 +const TAB_URL = EXAMPLE_URL + "doc_no-page-sources.html";
    1.12 +
    1.13 +let gTab, gDebuggee, gPanel, gDebugger;
    1.14 +let gEditor, gSources;
    1.15 +
    1.16 +function test() {
    1.17 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.18 +    gTab = aTab;
    1.19 +    gDebuggee = aDebuggee;
    1.20 +    gPanel = aPanel;
    1.21 +    gDebugger = gPanel.panelWin;
    1.22 +    gEditor = gDebugger.DebuggerView.editor;
    1.23 +    gSources = gDebugger.DebuggerView.Sources;
    1.24 +
    1.25 +    reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCES_ADDED)
    1.26 +      .then(testSourcesEmptyText)
    1.27 +      .then(() => closeDebuggerAndFinish(gPanel))
    1.28 +      .then(null, aError => {
    1.29 +        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
    1.30 +      });
    1.31 +  });
    1.32 +}
    1.33 +
    1.34 +function testSourcesEmptyText() {
    1.35 +    is(gSources.itemCount, 0,
    1.36 +      "Found no entries in the sources widget.");
    1.37 +
    1.38 +    is(gEditor.getText().length, 0,
    1.39 +      "The source editor should not have any text displayed.");
    1.40 +
    1.41 +    is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-text").getAttribute("value"),
    1.42 +       gDebugger.L10N.getStr("noSourcesText"),
    1.43 +      "The sources widget should now display 'This page has no sources'.");
    1.44 +}
    1.45 +
    1.46 +registerCleanupFunction(function() {
    1.47 +  gTab = null;
    1.48 +  gDebuggee = null;
    1.49 +  gPanel = null;
    1.50 +  gDebugger = null;
    1.51 +  gEditor = null;
    1.52 +  gSources = null;
    1.53 +});

mercurial