1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-14.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 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 that the variable inspection popup is hidden when 1.9 + * selecting text in the editor. 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 + 1.20 + // Allow this generator function to yield first. 1.21 + executeSoon(() => debuggee.start()); 1.22 + yield waitForSourceAndCaretAndScopes(panel, ".html", 24); 1.23 + 1.24 + // Select some text. 1.25 + let cursor = win.DebuggerView.editor.getOffset({ line: 15, ch: 12 }); 1.26 + let [ anchor, head ] = win.DebuggerView.editor.getPosition( 1.27 + cursor, 1.28 + cursor + 3 1.29 + ); 1.30 + win.DebuggerView.editor.setSelection(anchor, head); 1.31 + 1.32 + // Try to Inspect variable during selection. 1.33 + let popupOpened = yield intendOpenVarPopup(panel, { line: 15, ch: 12 }, true); 1.34 + 1.35 + // Ensure the bubble is not there 1.36 + ok(!popupOpened, 1.37 + "The popup is not opened"); 1.38 + ok(!bubble._markedText, 1.39 + "The marked text in the editor is not there."); 1.40 + 1.41 + // Try to Inspect variable after selection. 1.42 + popupOpened = yield intendOpenVarPopup(panel, { line: 15, ch: 12 }, false); 1.43 + 1.44 + // Ensure the bubble is not there 1.45 + ok(popupOpened, 1.46 + "The popup is opened"); 1.47 + ok(bubble._markedText, 1.48 + "The marked text in the editor is there."); 1.49 + 1.50 + yield resumeDebuggerThenCloseAndFinish(panel); 1.51 + }); 1.52 +}