Skip to content

Commit ed8b9c5

Browse files
committed
feat: tab bar integ tests to check visibility of tab bar based on preferences
1 parent 6546d91 commit ed8b9c5

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

test/UnitTestSuite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ define(function (require, exports, module) {
129129
require("spec/Extn-ESLint-integ-test");
130130
require("spec/Extn-CSSColorPreview-integ-test");
131131
require("spec/Extn-CollapseFolders-integ-test");
132+
require("spec/Extn-Tabbar-integ-test");
132133
// extension integration tests
133134
require("spec/Extn-CSSCodeHints-integ-test");
134135
require("spec/Extn-HTMLCodeHints-Lint-integ-test");
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* GNU AGPL-3.0 License
3+
*
4+
* Copyright (c) 2021 - present core.ai . All rights reserved.
5+
*
6+
* This program is free software: you can redistribute it and/or modify it
7+
* under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
14+
* for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see https://opensource.org/licenses/AGPL-3.0.
18+
*
19+
*/
20+
21+
/*global describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, awaitsFor, awaitsForDone, awaits, jsPromise */
22+
23+
define(function (require, exports, module) {
24+
const SpecRunnerUtils = require("spec/SpecRunnerUtils");
25+
26+
describe("integration:TabBar", function () {
27+
let testWindow, PreferencesManager, $, FileSystem, MainViewManager, CommandManager, Commands, testFilePath;
28+
29+
beforeAll(async function () {
30+
// Create the test window
31+
testWindow = await SpecRunnerUtils.createTestWindowAndRun();
32+
// Get reference to useful modules
33+
$ = testWindow.$;
34+
PreferencesManager = testWindow.brackets.test.PreferencesManager;
35+
FileSystem = testWindow.brackets.test.FileSystem;
36+
MainViewManager = testWindow.brackets.test.MainViewManager;
37+
CommandManager = testWindow.brackets.test.CommandManager;
38+
Commands = testWindow.brackets.test.Commands;
39+
40+
// Create a test file
41+
testFilePath = SpecRunnerUtils.getTempDirectory() + "/tabbar-test.js";
42+
await SpecRunnerUtils.createTempDirectory();
43+
await jsPromise(SpecRunnerUtils.createTextFile(testFilePath, "// Test file for TabBar", FileSystem));
44+
45+
// Open the test file
46+
await awaitsForDone(
47+
CommandManager.execute(Commands.FILE_OPEN, { fullPath: testFilePath }),
48+
"Open test file"
49+
);
50+
}, 30000);
51+
52+
afterAll(async function () {
53+
// Close the test file
54+
await awaitsForDone(CommandManager.execute(Commands.FILE_CLOSE_ALL), "Close all files");
55+
56+
testWindow = null;
57+
await SpecRunnerUtils.closeTestWindow();
58+
await SpecRunnerUtils.removeTempDirectory();
59+
}, 30000);
60+
61+
describe("Visibility", function () {
62+
it("should show tab bar when the feature is enabled", async function () {
63+
// Enable the tab bar feature
64+
PreferencesManager.set("tabBar.options", { showTabBar: true, numberOfTabs: -1 });
65+
66+
// Wait for the tab bar to become visible
67+
await awaitsFor(
68+
function () {
69+
return $("#phoenix-tab-bar").is(":visible");
70+
},
71+
"Tab bar to become visible",
72+
1000
73+
);
74+
75+
// Verify the tab bar is visible
76+
expect($("#phoenix-tab-bar").is(":visible")).toBe(true);
77+
});
78+
79+
it("should hide tab bar when the feature is disabled", async function () {
80+
// Disable the tab bar feature
81+
PreferencesManager.set("tabBar.options", { showTabBar: false, numberOfTabs: -1 });
82+
83+
// Wait for the tab bar to become hidden
84+
await awaitsFor(
85+
function () {
86+
return !$("#phoenix-tab-bar").is(":visible");
87+
},
88+
"Tab bar to become hidden",
89+
1000
90+
);
91+
92+
// Verify the tab bar is not visible
93+
expect($("#phoenix-tab-bar").is(":visible")).toBe(false);
94+
});
95+
});
96+
});
97+
});

0 commit comments

Comments
 (0)