Skip to content

Commit 3251dc1

Browse files
devvaannshabose
authored andcommitted
fix: main view manager tests failing
1 parent 4574416 commit 3251dc1

1 file changed

Lines changed: 15 additions & 50 deletions

File tree

test/spec/MainViewManager-integ-test.js

Lines changed: 15 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ define(function (require, exports, module) {
905905
_testPanelDoesntToggleBlocked();
906906
});
907907

908-
async function _testPanelToggleSuccess() {
908+
async function _testPanelHideSuccess() {
909909
panel1.show();
910910
expect(panel1.isVisible()).toBeTrue();
911911

@@ -915,12 +915,10 @@ define(function (require, exports, module) {
915915

916916
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
917917
expect(panel1.isVisible()).toBeFalse();
918-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
919-
expect(panel1.isVisible()).toBeTrue();
920918
}
921919

922-
it("should bottom panel toggle visibility on escape on focus in code editor", async function () {
923-
await _testPanelToggleSuccess();
920+
it("should escape hide bottom panel when editor is focused", async function () {
921+
await _testPanelHideSuccess();
924922
});
925923

926924
it("should bottom panel not toggle visibility on escape if modal dialog shown", async function () {
@@ -994,7 +992,7 @@ define(function (require, exports, module) {
994992
it("should dismiss panel if EscapeKeyEventHandler returns false", async function () {
995993
function escapeHandler() {return false;}
996994
expect(WorkspaceManager.addEscapeKeyEventHandler("x", escapeHandler)).toBeTrue();
997-
await _testPanelToggleSuccess();
995+
await _testPanelHideSuccess();
998996

999997
// cleanup
1000998
expect(WorkspaceManager.removeEscapeKeyEventHandler("x")).toBeTrue();
@@ -1031,7 +1029,7 @@ define(function (require, exports, module) {
10311029
expect(panel1.isVisible()).toBeTrue();
10321030
});
10331031

1034-
it("should escape close bottom panel one by one", async function () {
1032+
it("should escape collapse entire bottom panel container", async function () {
10351033
panel1.show();
10361034
expect(panel1.isVisible()).toBeTrue();
10371035
panel2.show();
@@ -1041,15 +1039,12 @@ define(function (require, exports, module) {
10411039
promise = MainViewManager._open(MainViewManager.FIRST_PANE, FileSystem.getFileForPath(testPath + "/test.js"));
10421040
await awaitsForDone(promise, "MainViewManager.doOpen");
10431041

1044-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1045-
expect(panel2.isVisible()).toBeFalse();
1046-
expect(panel1.isVisible()).toBeTrue();
10471042
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
10481043
expect(panel2.isVisible()).toBeFalse();
10491044
expect(panel1.isVisible()).toBeFalse();
10501045
});
10511046

1052-
it("should escape toggle bottom panel if there is only one shown", async function () {
1047+
it("should not toggle bottom panel back on subsequent escape", async function () {
10531048
panel1.show();
10541049
expect(panel1.isVisible()).toBeTrue();
10551050

@@ -1060,41 +1055,25 @@ define(function (require, exports, module) {
10601055
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
10611056
expect(panel1.isVisible()).toBeFalse();
10621057
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1063-
expect(panel1.isVisible()).toBeTrue();
1064-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
10651058
expect(panel1.isVisible()).toBeFalse();
10661059
});
10671060

1068-
it("should show closed bottom panel one by one in LRU order if shift-escape is pressed", async function () {
1069-
panel1.show(); panel2.show();
1070-
panel1.hide(); panel2.hide();
1061+
it("should shift-escape also collapse bottom panel", async function () {
1062+
panel1.show();
1063+
expect(panel1.isVisible()).toBeTrue();
1064+
10711065
expect(MainViewManager.getActivePaneId()).toEqual("first-pane");
10721066
promise = MainViewManager._open(MainViewManager.FIRST_PANE, FileSystem.getFileForPath(testPath + "/test.js"));
10731067
await awaitsForDone(promise, "MainViewManager.doOpen");
10741068

10751069
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0], {
10761070
shiftKey: true
10771071
});
1078-
expect(panel2.isVisible()).toBeTrue();
10791072
expect(panel1.isVisible()).toBeFalse();
1080-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0], {
1081-
shiftKey: true
1082-
});
1083-
expect(panel2.isVisible()).toBeTrue();
1084-
expect(panel1.isVisible()).toBeTrue();
1085-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0], {
1086-
shiftKey: true
1087-
});
1088-
expect(panel2.isVisible()).toBeTrue();
1089-
expect(panel1.isVisible()).toBeTrue();
1090-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1091-
expect(panel1.isVisible()).toBeFalse();
1092-
expect(panel2.isVisible()).toBeTrue();
10931073
});
10941074

1095-
it("should show closed bottom panel only if it can be shown if shift-escape is pressed", async function () {
1096-
panel1.show(); panel2.show();
1097-
panel1.hide(); panel2.hide();
1075+
it("should shift-escape collapse bottom panel regardless of canBeShown", async function () {
1076+
panel1.show();
10981077
panel2.registerCanBeShownHandler(function () {
10991078
return false;
11001079
});
@@ -1106,19 +1085,12 @@ define(function (require, exports, module) {
11061085
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0], {
11071086
shiftKey: true
11081087
});
1109-
expect(panel2.isVisible()).toBeFalse();
1110-
expect(panel1.isVisible()).toBeTrue();
1111-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0], {
1112-
shiftKey: true
1113-
});
1114-
expect(panel2.isVisible()).toBeFalse();
1115-
expect(panel1.isVisible()).toBeTrue();
1088+
expect(panel1.isVisible()).toBeFalse();
11161089
panel2.registerCanBeShownHandler(null);
11171090
});
11181091

1119-
it("should toggle closed bottom panel only if it can be shown if escape is pressed", async function () {
1120-
panel1.show(); panel2.show();
1121-
panel1.hide(); panel2.hide();
1092+
it("should escape collapse bottom panel regardless of canBeShown", async function () {
1093+
panel1.show();
11221094
panel2.registerCanBeShownHandler(function () {
11231095
return false;
11241096
});
@@ -1128,14 +1100,7 @@ define(function (require, exports, module) {
11281100
await awaitsForDone(promise, "MainViewManager.doOpen");
11291101

11301102
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1131-
expect(panel2.isVisible()).toBeFalse();
1132-
expect(panel1.isVisible()).toBeTrue();
1133-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1134-
expect(panel2.isVisible()).toBeFalse();
11351103
expect(panel1.isVisible()).toBeFalse();
1136-
SpecRunnerUtils.simulateKeyEvent(KeyEvent.DOM_VK_ESCAPE, "keydown", _$("#editor-holder")[0]);
1137-
expect(panel2.isVisible()).toBeFalse();
1138-
expect(panel1.isVisible()).toBeTrue();
11391104
panel2.registerCanBeShownHandler(null);
11401105
});
11411106
});

0 commit comments

Comments
 (0)