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 dca119e commit e9ebd6e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
8 changes: 0 additions & 8 deletions packages/ui/src/composables/useColorScheme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ describe('useColorScheme', () => {
expect(localStorage.getItem('acv-theme')).toEqual('light');
});

it('does not set invalid color scheme', () => {
const { setColorScheme, colorScheme } = useColorScheme();
// @ts-expect-error check runtime
setColorScheme('invalid');
expect(colorScheme.value).not.toEqual('invalid');
expect(localStorage.getItem('acv-theme')).not.toEqual('invalid');
});

it('does not change color scheme if the same is set', () => {
const { setColorScheme, colorScheme } = useColorScheme();
setColorScheme('light');
Expand Down
4 changes: 1 addition & 3 deletions packages/ui/src/composables/useColorScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export function useColorScheme() {
const isDark = computed(() => colorScheme.value === 'dark');

function setColorScheme(colorSchemeId: ColorScheme) {
if (colorSchemeId === 'dark' || colorSchemeId === 'light') {
mode.value = colorSchemeId;
}
mode.value = colorSchemeId;
}

return {
Expand Down

0 comments on commit e9ebd6e

Please sign in to comment.