diff --git a/packages/ui/src/composables/useColorScheme.spec.ts b/packages/ui/src/composables/useColorScheme.spec.ts index 4b76fdf15..fc8766fc5 100644 --- a/packages/ui/src/composables/useColorScheme.spec.ts +++ b/packages/ui/src/composables/useColorScheme.spec.ts @@ -1,4 +1,4 @@ -import { useColorScheme } from '@/composables/useColorScheme'; +import { ACV_THEME_LC_KEY, useColorScheme } from '@/composables/useColorScheme'; import { describe, expect, it } from 'vitest'; import { nextTick } from 'vue'; @@ -9,7 +9,7 @@ describe('useColorScheme', () => { }); it('returns dark mode status correctly', () => { - localStorage.setItem('acv-theme', 'dark'); + localStorage.setItem(ACV_THEME_LC_KEY, 'dark'); const { isDark } = useColorScheme(); expect(isDark.value).toEqual(true); }); @@ -19,7 +19,7 @@ describe('useColorScheme', () => { setColorScheme('light'); expect(colorScheme.value).toEqual('light'); await nextTick(); - expect(localStorage.getItem('acv-theme')).toEqual('light'); + expect(localStorage.getItem(ACV_THEME_LC_KEY)).toEqual('light'); }); it('does not change color scheme if the same is set', () => { diff --git a/packages/ui/src/composables/useColorScheme.ts b/packages/ui/src/composables/useColorScheme.ts index c9657e89f..30801333e 100644 --- a/packages/ui/src/composables/useColorScheme.ts +++ b/packages/ui/src/composables/useColorScheme.ts @@ -2,7 +2,7 @@ import { useColorMode } from '@vueuse/core'; import { computed } from 'vue'; export type ColorScheme = 'light' | 'dark'; -const ACV_THEME_LC_KEY = 'acv-color-scheme'; +export const ACV_THEME_LC_KEY = 'acv-color-scheme'; export function useColorScheme() { const mode = useColorMode({