browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.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  * Tests opening the variable inspection popup on a variable which has a
     6  * simple object as the value.
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
    11 function test() {
    12   Task.spawn(function() {
    13     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
    14     let win = panel.panelWin;
    15     let bubble = win.DebuggerView.VariableBubble;
    16     let tooltip = bubble._tooltip.panel;
    18     function verifyContents() {
    19       is(tooltip.querySelectorAll(".variables-view-container").length, 1,
    20         "There should be one variables view container added to the tooltip.");
    22       is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
    23         "There should be one scope with no header displayed.");
    24       is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
    25         "There should be one variable with no header displayed.");
    27       is(tooltip.querySelectorAll(".variables-view-property").length, 2,
    28         "There should be 2 properties displayed.");
    30       is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a",
    31         "The first property's name is correct.");
    32       is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1",
    33         "The first property's value is correct.");
    35       is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "__proto__",
    36         "The second property's name is correct.");
    37       is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "Object",
    38         "The second property's value is correct.");
    39     }
    41     // Allow this generator function to yield first.
    42     executeSoon(() => debuggee.start());
    43     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
    45     // Inspect variable.
    46     yield openVarPopup(panel, { line: 16, ch: 12 }, true);
    47     verifyContents();
    49     yield resumeDebuggerThenCloseAndFinish(panel);
    50   });
    51 }

mercurial