browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.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_variables-view-popup-05.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     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 + * Tests opening the variable inspection popup on a variable which has a
     1.9 + * simple object as the value.
    1.10 + */
    1.11 +
    1.12 +const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
    1.13 +
    1.14 +function test() {
    1.15 +  Task.spawn(function() {
    1.16 +    let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
    1.17 +    let win = panel.panelWin;
    1.18 +    let bubble = win.DebuggerView.VariableBubble;
    1.19 +    let tooltip = bubble._tooltip.panel;
    1.20 +
    1.21 +    function verifyContents() {
    1.22 +      is(tooltip.querySelectorAll(".variables-view-container").length, 1,
    1.23 +        "There should be one variables view container added to the tooltip.");
    1.24 +
    1.25 +      is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
    1.26 +        "There should be one scope with no header displayed.");
    1.27 +      is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
    1.28 +        "There should be one variable with no header displayed.");
    1.29 +
    1.30 +      is(tooltip.querySelectorAll(".variables-view-property").length, 2,
    1.31 +        "There should be 2 properties displayed.");
    1.32 +
    1.33 +      is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a",
    1.34 +        "The first property's name is correct.");
    1.35 +      is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1",
    1.36 +        "The first property's value is correct.");
    1.37 +
    1.38 +      is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "__proto__",
    1.39 +        "The second property's name is correct.");
    1.40 +      is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "Object",
    1.41 +        "The second property's value is correct.");
    1.42 +    }
    1.43 +
    1.44 +    // Allow this generator function to yield first.
    1.45 +    executeSoon(() => debuggee.start());
    1.46 +    yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
    1.47 +
    1.48 +    // Inspect variable.
    1.49 +    yield openVarPopup(panel, { line: 16, ch: 12 }, true);
    1.50 +    verifyContents();
    1.51 +
    1.52 +    yield resumeDebuggerThenCloseAndFinish(panel);
    1.53 +  });
    1.54 +}

mercurial