browser/devtools/debugger/test/browser_dbg_variables-view-popup-14.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 that the variable inspection popup is hidden when
michael@0 6 * selecting text in the editor.
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
michael@0 17 // Allow this generator function to yield first.
michael@0 18 executeSoon(() => debuggee.start());
michael@0 19 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
michael@0 20
michael@0 21 // Select some text.
michael@0 22 let cursor = win.DebuggerView.editor.getOffset({ line: 15, ch: 12 });
michael@0 23 let [ anchor, head ] = win.DebuggerView.editor.getPosition(
michael@0 24 cursor,
michael@0 25 cursor + 3
michael@0 26 );
michael@0 27 win.DebuggerView.editor.setSelection(anchor, head);
michael@0 28
michael@0 29 // Try to Inspect variable during selection.
michael@0 30 let popupOpened = yield intendOpenVarPopup(panel, { line: 15, ch: 12 }, true);
michael@0 31
michael@0 32 // Ensure the bubble is not there
michael@0 33 ok(!popupOpened,
michael@0 34 "The popup is not opened");
michael@0 35 ok(!bubble._markedText,
michael@0 36 "The marked text in the editor is not there.");
michael@0 37
michael@0 38 // Try to Inspect variable after selection.
michael@0 39 popupOpened = yield intendOpenVarPopup(panel, { line: 15, ch: 12 }, false);
michael@0 40
michael@0 41 // Ensure the bubble is not there
michael@0 42 ok(popupOpened,
michael@0 43 "The popup is opened");
michael@0 44 ok(bubble._markedText,
michael@0 45 "The marked text in the editor is there.");
michael@0 46
michael@0 47 yield resumeDebuggerThenCloseAndFinish(panel);
michael@0 48 });
michael@0 49 }

mercurial