Skip to content

Commit 26a013a

Browse files
committed
test: git switch project impast on git toolbar icon
1 parent 1af0b71 commit 26a013a

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

test/spec/Extn-Git-integ-test.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ define(function (require, exports, module) {
9191
await forCommandEnabled(Commands.CMD_GIT_PUSH, !isNonGit);
9292
}
9393

94-
async function verifyNonGitPanelIcons(notGitProject) {
95-
expect($gitPanel.find(".git-init").is(":visible")).toBe(notGitProject);
96-
expect($gitPanel.find(".git-clone").is(":visible")).toBe(notGitProject);
94+
async function verifyGitPanelIcons(isGitProject) {
95+
expect($gitPanel.find(".git-init").is(":visible")).toBe(!isGitProject);
96+
expect($gitPanel.find(".git-clone").is(":visible")).toBe(!isGitProject);
9797
// in non git repos the git buttons are not visible
98-
expect($gitPanel.find(".git-commit").is(":visible")).toBe(!notGitProject);
99-
expect($gitPanel.find(".git-prev-gutter").is(":visible")).toBe(!notGitProject);
100-
expect($gitPanel.find(".git-file-history").is(":visible")).toBe(!notGitProject);
101-
expect($gitPanel.find(".git-right-icons").is(":visible")).toBe(!notGitProject);
98+
expect($gitPanel.find(".git-commit").is(":visible")).toBe(isGitProject);
99+
expect($gitPanel.find(".git-prev-gutter").is(":visible")).toBe(isGitProject);
100+
expect($gitPanel.find(".git-file-history").is(":visible")).toBe(isGitProject);
101+
expect($gitPanel.find(".git-right-icons").is(":visible")).toBe(isGitProject);
102102
}
103103

104104
it("should only git settings, init and clone commands be enabled in non-git repos", async function () {
@@ -113,7 +113,7 @@ define(function (require, exports, module) {
113113
await __PR.execCommand(Commands.CMD_GIT_TOGGLE_PANEL);
114114
expect($gitPanel.is(":visible")).toBeTrue();
115115
expect($gitIcon.is(":visible")).toBeTrue();
116-
await verifyNonGitPanelIcons(true);
116+
await verifyGitPanelIcons(false);
117117
});
118118

119119
it("Should be able to initialize git repo", async function () {
@@ -391,15 +391,29 @@ define(function (require, exports, module) {
391391
await waitForBranchDropdownVisible(false);
392392
await waitForGitToolbarIconVisible(true);
393393
await verifyRepoInNonGitState();
394-
await verifyNonGitPanelIcons(true);
394+
await verifyGitPanelIcons(false);
395395
});
396396

397397
it("should switching back to git project show branch dropdown and show git panel controls", async () => {
398398
await SpecRunnerUtils.loadProjectInTestWindow(testPathGit);
399399
await waitForBranchDropdownVisible(true);
400400
await waitForGitToolbarIconVisible(true);
401401
await verifyRepoInNonGitState(false);
402-
await verifyNonGitPanelIcons(false);
402+
await verifyGitPanelIcons(true);
403+
});
404+
405+
it("should switching to a non-git project while git panel hidden hide git toolbar icon", async () => {
406+
await SpecRunnerUtils.loadProjectInTestWindow(nonGitReadOnlyTestFolder);
407+
await __PR.execCommand(Commands.CMD_GIT_TOGGLE_PANEL);
408+
expect($gitPanel.is(":visible")).toBeFalse();
409+
410+
await SpecRunnerUtils.loadProjectInTestWindow(nonGitReadOnlyTestFolder);
411+
await waitForGitToolbarIconVisible(false);
412+
413+
await SpecRunnerUtils.loadProjectInTestWindow(testPathGit);
414+
await waitForGitToolbarIconVisible(true);
415+
await __PR.execCommand(Commands.CMD_GIT_TOGGLE_PANEL);
416+
403417
});
404418

405419
});

0 commit comments

Comments
 (0)