Skip to content

Commit

Permalink
feat: build improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard Deisling committed Nov 19, 2024
1 parent e9ebd6e commit b9e4323
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/ui/src/composables/useColorScheme.spec.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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);
});
Expand All @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/composables/useColorScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit b9e4323

Please sign in to comment.