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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Make sure the right text shows when the page has no sources.
     6  */
     8 const TAB_URL = EXAMPLE_URL + "doc_no-page-sources.html";
    10 let gTab, gDebuggee, gPanel, gDebugger;
    11 let gEditor, gSources;
    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;
    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 }
    31 function testSourcesEmptyText() {
    32     is(gSources.itemCount, 0,
    33       "Found no entries in the sources widget.");
    35     is(gEditor.getText().length, 0,
    36       "The source editor should not have any text displayed.");
    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 }
    43 registerCleanupFunction(function() {
    44   gTab = null;
    45   gDebuggee = null;
    46   gPanel = null;
    47   gDebugger = null;
    48   gEditor = null;
    49   gSources = null;
    50 });

mercurial