browser/devtools/debugger/test/browser_dbg_variables-view-popup-01.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-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     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 literal 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 +    bubble._ignoreLiterals = false;
    1.22 +
    1.23 +    function verifyContents(textContent, className) {
    1.24 +      is(tooltip.querySelectorAll(".variables-view-container").length, 0,
    1.25 +        "There should be no variables view containers added to the tooltip.");
    1.26 +      is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
    1.27 +        "There should be a simple text node added to the tooltip instead.");
    1.28 +
    1.29 +      is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
    1.30 +        "The inspected property's value is correct.");
    1.31 +      ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.contains(className),
    1.32 +        "The inspected property's value is colorized correctly.");
    1.33 +    }
    1.34 +
    1.35 +    // Allow this generator function to yield first.
    1.36 +    executeSoon(() => debuggee.start());
    1.37 +    yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
    1.38 +
    1.39 +    // Inspect variables.
    1.40 +    yield openVarPopup(panel, { line: 15, ch: 12 });
    1.41 +    verifyContents("1", "token-number");
    1.42 +
    1.43 +    yield reopenVarPopup(panel, { line: 16, ch: 21 });
    1.44 +    verifyContents("1", "token-number");
    1.45 +
    1.46 +    yield reopenVarPopup(panel, { line: 17, ch: 21 });
    1.47 +    verifyContents("1", "token-number");
    1.48 +
    1.49 +    yield reopenVarPopup(panel, { line: 17, ch: 27 });
    1.50 +    verifyContents("\"beta\"", "token-string");
    1.51 +
    1.52 +    yield reopenVarPopup(panel, { line: 17, ch: 44 });
    1.53 +    verifyContents("false", "token-boolean");
    1.54 +
    1.55 +    yield reopenVarPopup(panel, { line: 17, ch: 54 });
    1.56 +    verifyContents("null", "token-null");
    1.57 +
    1.58 +    yield reopenVarPopup(panel, { line: 17, ch: 63 });
    1.59 +    verifyContents("undefined", "token-undefined");
    1.60 +
    1.61 +    yield resumeDebuggerThenCloseAndFinish(panel);
    1.62 +  });
    1.63 +}

mercurial