browser/devtools/debugger/test/browser_dbg_variables-view-popup-02.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-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     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 + * a property accessible via getters and setters.
    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(textContent, className) {
    1.22 +      is(tooltip.querySelectorAll(".variables-view-container").length, 0,
    1.23 +        "There should be no variables view containers added to the tooltip.");
    1.24 +      is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
    1.25 +        "There should be a simple text node added to the tooltip instead.");
    1.26 +
    1.27 +      is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
    1.28 +        "The inspected property's value is correct.");
    1.29 +      ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.contains(className),
    1.30 +        "The inspected property's value is colorized correctly.");
    1.31 +    }
    1.32 +
    1.33 +    // Allow this generator function to yield first.
    1.34 +    executeSoon(() => debuggee.start());
    1.35 +    yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
    1.36 +
    1.37 +    // Inspect properties.
    1.38 +    yield openVarPopup(panel, { line: 19, ch: 10 });
    1.39 +    verifyContents("42", "token-number");
    1.40 +
    1.41 +    yield reopenVarPopup(panel, { line: 20, ch: 14 });
    1.42 +    verifyContents("42", "token-number");
    1.43 +
    1.44 +    yield reopenVarPopup(panel, { line: 21, ch: 14 });
    1.45 +    verifyContents("42", "token-number");
    1.46 +
    1.47 +    yield resumeDebuggerThenCloseAndFinish(panel);
    1.48 +  });
    1.49 +}

mercurial