browser/devtools/debugger/test/browser_dbg_variables-view-popup-02.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:82013cf6727c
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests opening the variable inspection popup on a variable which has a
6 * a property accessible via getters and setters.
7 */
8
9 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
10
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;
17
18 function verifyContents(textContent, className) {
19 is(tooltip.querySelectorAll(".variables-view-container").length, 0,
20 "There should be no variables view containers added to the tooltip.");
21 is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
22 "There should be a simple text node added to the tooltip instead.");
23
24 is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
25 "The inspected property's value is correct.");
26 ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.contains(className),
27 "The inspected property's value is colorized correctly.");
28 }
29
30 // Allow this generator function to yield first.
31 executeSoon(() => debuggee.start());
32 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
33
34 // Inspect properties.
35 yield openVarPopup(panel, { line: 19, ch: 10 });
36 verifyContents("42", "token-number");
37
38 yield reopenVarPopup(panel, { line: 20, ch: 14 });
39 verifyContents("42", "token-number");
40
41 yield reopenVarPopup(panel, { line: 21, ch: 14 });
42 verifyContents("42", "token-number");
43
44 yield resumeDebuggerThenCloseAndFinish(panel);
45 });
46 }

mercurial