Skip to content

Commit 77bcb72

Browse files
committed
fix: unit test fix for use-settings, minor i18n fix
1 parent 89c89bc commit 77bcb72

2 files changed

Lines changed: 3 additions & 30 deletions

File tree

app/components/AppFooter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const closeModal = () => modalRef.value?.close?.()
9797
</li>
9898
</ul>
9999
<p class="text-fg-muted leading-relaxed">
100-
<i18n-t keypath="shortcuts.disable" tag="span" scope="global">
100+
<i18n-t keypath="shortcuts.disable_shortcuts" tag="span" scope="global">
101101
<template #settings>
102102
<NuxtLink
103103
:to="{ name: 'settings' }"
Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
1+
import { beforeEach, describe, expect, it, vi } from 'vitest'
22

33
describe('useSettings - keyboardShortcuts', () => {
44
beforeEach(() => {
5-
localStorage.clear()
6-
vi.resetModules()
7-
})
8-
9-
afterEach(() => {
10-
// Reset the singleton so the next test gets a fresh instance
11-
localStorage.clear()
125
vi.resetModules()
136
})
147

@@ -29,6 +22,7 @@ describe('useSettings - keyboardShortcuts', () => {
2922

3023
it('should reflect changes made via settings', async () => {
3124
const { useSettings } = await import('../../../app/composables/useSettings')
25+
const { useKeyboardShortcuts } = await import('../../../app/composables/useSettings')
3226
const { settings } = useSettings()
3327
const enabled = useKeyboardShortcuts()
3428

@@ -51,25 +45,4 @@ describe('useSettings - keyboardShortcuts', () => {
5145
expect(enabled.value).toBe(false)
5246
})
5347
})
54-
55-
describe('persistence', () => {
56-
it('should persist keyboardShortcuts=false to localStorage', async () => {
57-
const { useSettings } = await import('../../../app/composables/useSettings')
58-
const { settings } = useSettings()
59-
settings.value.keyboardShortcuts = false
60-
61-
const stored = JSON.parse(localStorage.getItem('npmx-settings') ?? '{}')
62-
expect(stored.keyboardShortcuts).toBe(false)
63-
})
64-
65-
it('should persist keyboardShortcuts=true to localStorage', async () => {
66-
const { useSettings } = await import('../../../app/composables/useSettings')
67-
const { settings } = useSettings()
68-
settings.value.keyboardShortcuts = false
69-
settings.value.keyboardShortcuts = true
70-
71-
const stored = JSON.parse(localStorage.getItem('npmx-settings') ?? '{}')
72-
expect(stored.keyboardShortcuts).toBe(true)
73-
})
74-
})
7548
})

0 commit comments

Comments
 (0)