mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-08 04:10:35 -07:00
feat(cli): support independent light and dark mode themes
This commit is contained in:
@@ -23,30 +23,46 @@ describe('theme', () => {
|
||||
mockSettings = {
|
||||
merged: {
|
||||
ui: {
|
||||
theme: 'test-theme',
|
||||
themeLight: 'test-light-theme',
|
||||
themeDark: 'test-dark-theme',
|
||||
},
|
||||
},
|
||||
} as unknown as LoadedSettings;
|
||||
});
|
||||
|
||||
it('should return null if theme is found', () => {
|
||||
it('should return null if themes are found', () => {
|
||||
vi.mocked(themeManager.findThemeByName).mockReturnValue(
|
||||
{} as unknown as ReturnType<typeof themeManager.findThemeByName>,
|
||||
);
|
||||
const result = validateTheme(mockSettings);
|
||||
expect(result).toBeNull();
|
||||
expect(themeManager.findThemeByName).toHaveBeenCalledWith('test-theme');
|
||||
expect(themeManager.findThemeByName).toHaveBeenCalledWith(
|
||||
'test-light-theme',
|
||||
);
|
||||
expect(themeManager.findThemeByName).toHaveBeenCalledWith(
|
||||
'test-dark-theme',
|
||||
);
|
||||
});
|
||||
|
||||
it('should return error message if theme is not found', () => {
|
||||
vi.mocked(themeManager.findThemeByName).mockReturnValue(undefined);
|
||||
it('should return error message if light theme is not found', () => {
|
||||
vi.mocked(themeManager.findThemeByName).mockImplementation((name) => name === 'test-dark-theme'
|
||||
? ({} as unknown as ReturnType<typeof themeManager.findThemeByName>)
|
||||
: undefined);
|
||||
const result = validateTheme(mockSettings);
|
||||
expect(result).toBe('Theme "test-theme" not found.');
|
||||
expect(themeManager.findThemeByName).toHaveBeenCalledWith('test-theme');
|
||||
expect(result).toBe('Theme "test-light-theme" not found.');
|
||||
});
|
||||
|
||||
it('should return null if theme is undefined', () => {
|
||||
mockSettings.merged.ui.theme = undefined;
|
||||
it('should return error message if dark theme is not found', () => {
|
||||
vi.mocked(themeManager.findThemeByName).mockImplementation((name) => name === 'test-light-theme'
|
||||
? ({} as unknown as ReturnType<typeof themeManager.findThemeByName>)
|
||||
: undefined);
|
||||
const result = validateTheme(mockSettings);
|
||||
expect(result).toBe('Theme "test-dark-theme" not found.');
|
||||
});
|
||||
|
||||
it('should return null if themes are undefined', () => {
|
||||
mockSettings.merged.ui.themeLight = undefined;
|
||||
mockSettings.merged.ui.themeDark = undefined;
|
||||
const result = validateTheme(mockSettings);
|
||||
expect(result).toBeNull();
|
||||
expect(themeManager.findThemeByName).not.toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user