michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests that the variable inspection popup is hidden when michael@0: * selecting text in the editor. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; michael@0: michael@0: function test() { michael@0: Task.spawn(function*() { michael@0: let [tab, debuggee, panel] = yield initDebugger(TAB_URL); michael@0: let win = panel.panelWin; michael@0: let bubble = win.DebuggerView.VariableBubble; michael@0: michael@0: // Allow this generator function to yield first. michael@0: executeSoon(() => debuggee.start()); michael@0: yield waitForSourceAndCaretAndScopes(panel, ".html", 24); michael@0: michael@0: // Select some text. michael@0: let cursor = win.DebuggerView.editor.getOffset({ line: 15, ch: 12 }); michael@0: let [ anchor, head ] = win.DebuggerView.editor.getPosition( michael@0: cursor, michael@0: cursor + 3 michael@0: ); michael@0: win.DebuggerView.editor.setSelection(anchor, head); michael@0: michael@0: // Try to Inspect variable during selection. michael@0: let popupOpened = yield intendOpenVarPopup(panel, { line: 15, ch: 12 }, true); michael@0: michael@0: // Ensure the bubble is not there michael@0: ok(!popupOpened, michael@0: "The popup is not opened"); michael@0: ok(!bubble._markedText, michael@0: "The marked text in the editor is not there."); michael@0: michael@0: // Try to Inspect variable after selection. michael@0: popupOpened = yield intendOpenVarPopup(panel, { line: 15, ch: 12 }, false); michael@0: michael@0: // Ensure the bubble is not there michael@0: ok(popupOpened, michael@0: "The popup is opened"); michael@0: ok(bubble._markedText, michael@0: "The marked text in the editor is there."); michael@0: michael@0: yield resumeDebuggerThenCloseAndFinish(panel); michael@0: }); michael@0: }