Skip to content

Commit 9c946fd

Browse files
authored
chore: move light mode out of experimental (podman-desktop#8290)
Replaces the experimental text from appearance setting, removes FIXMEs from system mode, and updating tests. Fixes podman-desktop#8202. Signed-off-by: Tim deBoer <[email protected]>
1 parent 9542c5f commit 9c946fd

File tree

4 files changed

+10
-24
lines changed

4 files changed

+10
-24
lines changed

packages/main/src/plugin/appearance-init.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export class AppearanceInit {
2525
init(): void {
2626
const appearanceConfiguration: IConfigurationNode = {
2727
id: 'preferences.appearance',
28-
title: 'Experimental Appearance',
28+
title: 'Appearance',
2929
type: 'object',
3030
properties: {
3131
[AppearanceSettings.SectionName + '.' + AppearanceSettings.Appearance]: {
32-
description: 'Experimental setting to test support for light mode',
32+
description: 'Select between light or dark mode, or use your system setting.',
3333
type: 'string',
3434
enum: ['system', 'dark', 'light'],
3535
default: 'system',

packages/renderer/src/lib/appearance/Appearance.spec.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ async function awaitRender(): Promise<RenderResult<Appearance>> {
6363
return result;
6464
}
6565

66-
// temporary as only dark mode is supported as rendering for now
67-
// it should return empty later
68-
test('Expect dark mode using system when OS is set to light', async () => {
66+
test('Expect light mode using system when OS is set to light', async () => {
6967
(window as any).matchMedia = vi.fn().mockReturnValue({
7068
matches: false,
7169
addEventListener: vi.fn(),
@@ -75,11 +73,8 @@ test('Expect dark mode using system when OS is set to light', async () => {
7573
getConfigurationValueMock.mockResolvedValue(AppearanceSettings.SystemEnumValue);
7674

7775
const { baseElement } = await awaitRender();
78-
79-
const val = getRootElementClassesValue(baseElement);
80-
81-
// expect to have class being "dark" as for now we force dark mode in system mode
82-
expect(val).toBe('dark');
76+
// expect to have no (dark) class as OS is using light
77+
expect(getRootElementClassesValue(baseElement)).toBe('');
8378
});
8479

8580
test('Expect dark mode using system when OS is set to dark', async () => {

packages/renderer/src/lib/appearance/appearance-util.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export class AppearanceUtil {
3030
if (appearance === AppearanceSettings.SystemEnumValue) {
3131
// need to read the system default theme using the window.matchMedia
3232
isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
33-
//FIXME: for now we hardcode to the dark theme even if the Operatin System is using light theme
34-
// as it renders correctly only in dark mode today
35-
isDark = true;
3633
} else if (appearance === AppearanceSettings.LightEnumValue) {
3734
isDark = false;
3835
} else if (appearance === AppearanceSettings.DarkEnumValue) {
@@ -49,9 +46,7 @@ export class AppearanceUtil {
4946
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
5047

5148
if (themeName === AppearanceSettings.SystemEnumValue) {
52-
//FIXME: for now we hardcode to the dark theme even if the Operating System is using light theme
53-
// return systemTheme;
54-
return 'dark';
49+
return systemTheme;
5550
}
5651

5752
return themeName ?? systemTheme;

packages/renderer/src/lib/appearance/appearance-utils.spec.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ beforeEach(() => {
3333
(window as any).getConfigurationValue = getConfigurationValueMock;
3434
});
3535

36-
// temporary as only dark mode is supported as rendering for now
37-
// it should return empty later
38-
test('Expect dark mode using system when OS is set to light', async () => {
36+
test('Expect light mode using system when OS is set to light', async () => {
3937
(window as any).matchMedia = vi.fn().mockReturnValue({
4038
matches: false,
4139
addEventListener: vi.fn(),
@@ -44,8 +42,8 @@ test('Expect dark mode using system when OS is set to light', async () => {
4442

4543
getConfigurationValueMock.mockResolvedValue(AppearanceSettings.SystemEnumValue);
4644

47-
// expect to have class being "dark" as for now we force dark mode in system mode
48-
expect(await appearanceUtil.isDarkMode()).toBe(true);
45+
// expect to have class being "light" as OS is using light
46+
expect(await appearanceUtil.isDarkMode()).toBe(false);
4947
});
5048

5149
test('Expect dark mode using system when OS is set to dark', async () => {
@@ -130,9 +128,7 @@ describe('getTheme', () => {
130128

131129
const theme = await appearanceUtil.getTheme();
132130

133-
// FIXME: for now we hardcode to the dark theme even if the Operating System is using light theme
134-
// expect(theme).toBe('light');
135-
expect(theme).toBe('dark');
131+
expect(theme).toBe('light');
136132
});
137133

138134
test('should return dark if value is dark even if os is light', async () => {

0 commit comments

Comments
 (0)