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

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:5e34b4cbbc0e
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 * simple literal as the value.
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 bubble._ignoreLiterals = false;
19
20 function verifyContents(textContent, className) {
21 is(tooltip.querySelectorAll(".variables-view-container").length, 0,
22 "There should be no variables view containers added to the tooltip.");
23 is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
24 "There should be a simple text node added to the tooltip instead.");
25
26 is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
27 "The inspected property's value is correct.");
28 ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.contains(className),
29 "The inspected property's value is colorized correctly.");
30 }
31
32 // Allow this generator function to yield first.
33 executeSoon(() => debuggee.start());
34 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
35
36 // Inspect variables.
37 yield openVarPopup(panel, { line: 15, ch: 12 });
38 verifyContents("1", "token-number");
39
40 yield reopenVarPopup(panel, { line: 16, ch: 21 });
41 verifyContents("1", "token-number");
42
43 yield reopenVarPopup(panel, { line: 17, ch: 21 });
44 verifyContents("1", "token-number");
45
46 yield reopenVarPopup(panel, { line: 17, ch: 27 });
47 verifyContents("\"beta\"", "token-string");
48
49 yield reopenVarPopup(panel, { line: 17, ch: 44 });
50 verifyContents("false", "token-boolean");
51
52 yield reopenVarPopup(panel, { line: 17, ch: 54 });
53 verifyContents("null", "token-null");
54
55 yield reopenVarPopup(panel, { line: 17, ch: 63 });
56 verifyContents("undefined", "token-undefined");
57
58 yield resumeDebuggerThenCloseAndFinish(panel);
59 });
60 }

mercurial