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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests opening the variable inspection popup on a variable which has a
michael@0 6 * simple literal as the value.
michael@0 7 */
michael@0 8
michael@0 9 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
michael@0 10
michael@0 11 function test() {
michael@0 12 Task.spawn(function() {
michael@0 13 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
michael@0 14 let win = panel.panelWin;
michael@0 15 let bubble = win.DebuggerView.VariableBubble;
michael@0 16 let tooltip = bubble._tooltip.panel;
michael@0 17
michael@0 18 bubble._ignoreLiterals = false;
michael@0 19
michael@0 20 function verifyContents(textContent, className) {
michael@0 21 is(tooltip.querySelectorAll(".variables-view-container").length, 0,
michael@0 22 "There should be no variables view containers added to the tooltip.");
michael@0 23 is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
michael@0 24 "There should be a simple text node added to the tooltip instead.");
michael@0 25
michael@0 26 is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
michael@0 27 "The inspected property's value is correct.");
michael@0 28 ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.contains(className),
michael@0 29 "The inspected property's value is colorized correctly.");
michael@0 30 }
michael@0 31
michael@0 32 // Allow this generator function to yield first.
michael@0 33 executeSoon(() => debuggee.start());
michael@0 34 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
michael@0 35
michael@0 36 // Inspect variables.
michael@0 37 yield openVarPopup(panel, { line: 15, ch: 12 });
michael@0 38 verifyContents("1", "token-number");
michael@0 39
michael@0 40 yield reopenVarPopup(panel, { line: 16, ch: 21 });
michael@0 41 verifyContents("1", "token-number");
michael@0 42
michael@0 43 yield reopenVarPopup(panel, { line: 17, ch: 21 });
michael@0 44 verifyContents("1", "token-number");
michael@0 45
michael@0 46 yield reopenVarPopup(panel, { line: 17, ch: 27 });
michael@0 47 verifyContents("\"beta\"", "token-string");
michael@0 48
michael@0 49 yield reopenVarPopup(panel, { line: 17, ch: 44 });
michael@0 50 verifyContents("false", "token-boolean");
michael@0 51
michael@0 52 yield reopenVarPopup(panel, { line: 17, ch: 54 });
michael@0 53 verifyContents("null", "token-null");
michael@0 54
michael@0 55 yield reopenVarPopup(panel, { line: 17, ch: 63 });
michael@0 56 verifyContents("undefined", "token-undefined");
michael@0 57
michael@0 58 yield resumeDebuggerThenCloseAndFinish(panel);
michael@0 59 });
michael@0 60 }

mercurial