-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathenv.test.ts
More file actions
110 lines (99 loc) · 2.92 KB
/
env.test.ts
File metadata and controls
110 lines (99 loc) · 2.92 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { describe, expect, it, vi } from "vitest";
import { getWindowChromeOptions, getWindowControlsLayout } from "./env";
vi.mock("./linuxWindowControls", () => ({
getLinuxWindowControlsLayout: vi.fn().mockReturnValue({
left: [],
right: ["minimize", "maximize", "close"],
}),
}));
describe("getWindowControlsLayout", () => {
it("uses the standard macOS traffic-light placement in ltr locales", () => {
expect(getWindowControlsLayout({ locale: "en-US", platform: "macos" })).toEqual({
left: ["close", "minimize", "maximize"],
right: [],
});
});
it("keeps macOS traffic lights left-aligned in rtl locales", () => {
expect(getWindowControlsLayout({ locale: "ar", platform: "macos" })).toEqual({
left: ["close", "minimize", "maximize"],
right: [],
});
});
it("uses the standard Windows control layout in ltr locales", () => {
expect(getWindowControlsLayout({ locale: "en-US", platform: "windows" })).toEqual({
left: [],
right: ["minimize", "maximize", "close"],
});
});
it("mirrors Windows controls in rtl locales", () => {
expect(getWindowControlsLayout({ locale: "he", platform: "windows" })).toEqual({
left: ["close", "maximize", "minimize"],
right: [],
});
});
it("keeps Linux layout unchanged even in rtl locales", () => {
expect(getWindowControlsLayout({ locale: "ar", platform: "linux" })).toEqual({
left: [],
right: ["minimize", "maximize", "close"],
});
});
});
describe("getWindowChromeOptions", () => {
it("uses transparent overlay and light symbols for windows in dark mode", () => {
expect(
getWindowChromeOptions({
darkMode: true,
linuxTitleBarMode: "native",
platform: "windows",
}),
).toEqual({
titleBarStyle: "hidden",
titleBarOverlay: {
height: 52,
color: "#00000000",
symbolColor: "#ffffff",
},
});
});
it("uses transparent overlay and dark symbols for windows in light mode", () => {
expect(
getWindowChromeOptions({
darkMode: false,
linuxTitleBarMode: "native",
platform: "windows",
}),
).toEqual({
titleBarStyle: "hidden",
titleBarOverlay: {
height: 52,
color: "#00000000",
symbolColor: "#000000",
},
});
});
it("keeps linux native titlebars unchanged", () => {
expect(
getWindowChromeOptions({
darkMode: true,
linuxTitleBarMode: "native",
platform: "linux",
}),
).toEqual({});
});
it("keeps linux overlay transparent workaround and applies symbol contrast", () => {
expect(
getWindowChromeOptions({
darkMode: false,
linuxTitleBarMode: "overlay",
platform: "linux",
}),
).toEqual({
titleBarStyle: "hidden",
titleBarOverlay: {
height: 52,
color: "#01000000",
symbolColor: "#000000",
},
});
});
});