fix(ui): backfill legacy appearance theme to system (#1510)
This commit is contained in:
@@ -123,7 +123,7 @@ describe('AppConfigService', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('resets legacy saved palette state to the default theme and dark appearance', () => {
|
||||
it('resets legacy saved palette state to the default theme and system appearance', () => {
|
||||
localStorageMock.setItem('appConfigState', JSON.stringify({
|
||||
preset: 'Aura',
|
||||
primary: 'blue',
|
||||
@@ -143,14 +143,14 @@ describe('AppConfigService', () => {
|
||||
|
||||
expect(service.appState()).toEqual({
|
||||
themePreference: 'grimmory',
|
||||
appearancePreference: 'dark',
|
||||
appearancePreference: 'system',
|
||||
customPrimary: 'orange',
|
||||
});
|
||||
expect(root.dataset['appTheme']).toBe('grimmory');
|
||||
expect(root.classList.contains('dark')).toBe(true);
|
||||
expect(root.classList.contains('dark')).toBe(false);
|
||||
expect(localStorageMock.getItem('appConfigState')).toBe(JSON.stringify({
|
||||
themePreference: 'grimmory',
|
||||
appearancePreference: 'dark',
|
||||
appearancePreference: 'system',
|
||||
customPrimary: 'orange',
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
|
||||
const PRIMARY_COLOR_STOPS = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950'];
|
||||
const DEFAULT_APPEARANCE_PREFERENCE: AppearancePreference = 'system';
|
||||
const LEGACY_APPEARANCE_PREFERENCE: AppearancePreference = 'dark';
|
||||
|
||||
type StoredAppState = Partial<AppState> & {
|
||||
preset?: unknown;
|
||||
@@ -95,7 +94,7 @@ export class AppConfigService {
|
||||
if (this.isLegacyPaletteState(state)) {
|
||||
return this.withDefaults({
|
||||
themePreference: DEFAULT_APP_THEME,
|
||||
appearancePreference: LEGACY_APPEARANCE_PREFERENCE,
|
||||
appearancePreference: DEFAULT_APPEARANCE_PREFERENCE,
|
||||
customPrimary: DEFAULT_CUSTOM_PRIMARY,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user