feat(ui): light mode and new theming system (#1468)
This commit is contained in:
@@ -1,21 +1,34 @@
|
||||
import {describe, expect, expectTypeOf, it} from 'vitest';
|
||||
|
||||
import {AppState} from './app-state.model';
|
||||
import {
|
||||
APP_THEME_OPTIONS,
|
||||
AppearancePreference,
|
||||
AppState,
|
||||
AppTheme,
|
||||
CustomPrimary,
|
||||
DEFAULT_APP_THEME,
|
||||
THEME_REGISTRY,
|
||||
} from './app-state.model';
|
||||
|
||||
describe('app-state.model', () => {
|
||||
it('supports partially specified visual state presets', () => {
|
||||
it('supports partially specified visual theme state', () => {
|
||||
const appState: AppState = {
|
||||
preset: 'midnight',
|
||||
primary: '#112233'
|
||||
themePreference: DEFAULT_APP_THEME,
|
||||
appearancePreference: 'system',
|
||||
};
|
||||
|
||||
expect(appState.preset).toBe('midnight');
|
||||
expect(appState.surface).toBeUndefined();
|
||||
expect(appState.themePreference).toBe(DEFAULT_APP_THEME);
|
||||
expect(appState.appearancePreference).toBe('system');
|
||||
});
|
||||
|
||||
it('keeps each field optional and string-based', () => {
|
||||
expectTypeOf<AppState['preset']>().toEqualTypeOf<string | undefined>();
|
||||
expectTypeOf<AppState['primary']>().toEqualTypeOf<string | undefined>();
|
||||
expectTypeOf<AppState['surface']>().toEqualTypeOf<string | undefined>();
|
||||
it('keeps each field optional and constrained to supported values', () => {
|
||||
expectTypeOf<AppState['themePreference']>().toEqualTypeOf<AppTheme | undefined>();
|
||||
expectTypeOf<AppState['appearancePreference']>().toEqualTypeOf<AppearancePreference | undefined>();
|
||||
expectTypeOf<AppState['customPrimary']>().toEqualTypeOf<CustomPrimary | undefined>();
|
||||
});
|
||||
|
||||
it('derives theme options from the registry', () => {
|
||||
expect(APP_THEME_OPTIONS).toBe(THEME_REGISTRY);
|
||||
expect(APP_THEME_OPTIONS.some(option => option.name === DEFAULT_APP_THEME)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user