-
Notifications
You must be signed in to change notification settings - Fork 510
/
Copy pathISECompatibility.test.ts
61 lines (49 loc) · 2.94 KB
/
ISECompatibility.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as assert from "assert";
import * as vscode from "vscode";
import { ISECompatibilityFeature } from "../../src/features/ISECompatibility";
import utils = require("../utils");
describe("ISECompatibility feature", function() {
let currentTheme: string;
before(async function() {
// Save user's current theme.
currentTheme = await vscode.workspace.getConfiguration("workbench").get("colorTheme");
await utils.ensureExtensionIsActivated();
});
beforeEach(async function() { await vscode.commands.executeCommand("PowerShell.EnableISEMode"); });
afterEach(async function() { await vscode.commands.executeCommand("PowerShell.DisableISEMode"); });
after(async function() {
// Reset user's current theme.
await vscode.workspace.getConfiguration("workbench").update("colorTheme", currentTheme, true);
assert.strictEqual(vscode.workspace.getConfiguration("workbench").get("colorTheme"), currentTheme);
});
it("It sets ISE Settings", async function() {
for (const iseSetting of ISECompatibilityFeature.settings) {
const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name);
assert.strictEqual(currently, iseSetting.value);
}
});
it("It unsets ISE Settings", async function() {
// Change state to something that DisableISEMode will change
await vscode.workspace.getConfiguration("workbench").update("colorTheme", "PowerShell ISE", true);
assert.strictEqual(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "PowerShell ISE");
await vscode.commands.executeCommand("PowerShell.DisableISEMode");
for (const iseSetting of ISECompatibilityFeature.settings) {
const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name);
assert.notStrictEqual(currently, iseSetting.value);
}
});
it("It doesn't change theme when disabled if theme was manually changed after being enabled", async function() {
assert.strictEqual(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "PowerShell ISE");
// "Manually" change theme after enabling ISE mode. Use a built-in theme but not the default.
await vscode.workspace.getConfiguration("workbench").update("colorTheme", "Monokai", true);
assert.strictEqual(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "Monokai");
await vscode.commands.executeCommand("PowerShell.DisableISEMode");
for (const iseSetting of ISECompatibilityFeature.settings) {
const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name);
assert.notStrictEqual(currently, iseSetting.value);
}
assert.strictEqual(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "Monokai");
});
});