Skip to content

Commit d37490b

Browse files
committed
test: integ for escape key should not toggle panel if code hints popup visible
1 parent 2d795a7 commit d37490b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/features/ParameterHintsManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ define(function (require, exports, module) {
231231
*
232232
*/
233233
function dismissHint(editor) {
234+
popupShown = false;
234235
if (hintState.visible) {
235236
$hintContainer.hide();
236237
$hintContent.empty();
237238
hintState = {};
238-
popupShown = false;
239239

240240
if (editor) {
241241
editor.off("cursorActivity.ParameterHinting", handleCursorActivity);

test/spec/MainViewManager-integ-test.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

22-
/*global describe, beforeEach, beforeAll, afterAll, afterEach, it, expect, awaitsForDone, spyOn, jasmine, Phoenix */
22+
/*global describe, beforeEach, beforeAll, afterAll, it, expect, awaitsForDone, spyOn, jasmine, awaitsFor */
2323

2424
define(function (require, exports, module) {
2525

@@ -1009,6 +1009,28 @@ define(function (require, exports, module) {
10091009
expect(WorkspaceManager.removeEscapeKeyEventHandler("x")).toBeTrue();
10101010
});
10111011

1012+
it("should not dismiss any panel if codehints are visible", async function () {
1013+
panel1.show();
1014+
panel2.hide();
1015+
expect(panel1.isVisible()).toBeTrue();
1016+
1017+
expect(MainViewManager.getActivePaneId()).toEqual("first-pane");
1018+
promise = MainViewManager._open(MainViewManager.FIRST_PANE, FileSystem.getFileForPath(testPath + "/test.js"));
1019+
await awaitsForDone(promise, "MainViewManager.doOpen");
1020+
let editor = EditorManager.getActiveEditor();
1021+
editor.setCursorPos(0, 0);
1022+
await awaitsForDone(CommandManager.execute(Commands.SHOW_CODE_HINTS));
1023+
await awaitsFor(function () {
1024+
return testWindow.$(".codehint-menu").is(":visible");
1025+
}, "codehints to be shown");
1026+
1027+
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1028+
await awaitsFor(function () {
1029+
return !testWindow.$(".codehint-menu").is(":visible");
1030+
}, "codehints to be dismissed on escape press");
1031+
expect(panel1.isVisible()).toBeTrue();
1032+
});
1033+
10121034
it("should escape close bottom panel one by one", async function () {
10131035
panel1.show();
10141036
expect(panel1.isVisible()).toBeTrue();

0 commit comments

Comments
 (0)