20260903221055

This commit is contained in:
oneao committed 2026-09-03 22:10:55 +08:00
1 parent 3d4e2c7413
commit 0928437c67
46 files changed
+2121 -1643

No files matched your search

+11 -4
View File
@@ -3,6 +3,7 @@ import { nextTick } from 'vue'
import { createTestPinia } from '../helpers/app.js'
import { useAppStore } from '@/stores/app'
import { useAuthStore } from '@/stores/auth'
import { useI18nStore } from '@/stores/i18n'
// app store 的 initThemeSync 依赖 theme 模块操作 documentElement,jest 环境可安全执行
vi.mock('@/theme/index', () => ({
@@ -22,7 +23,6 @@ describe('app store · 主题与布局', () => {
const app = useAppStore()
expect(app.darkMode).toBe(false)
expect(app.sidebarCollapsed).toBe(false)
expect(app.locale).toBe('zh-CN')
expect(app.visitedTabs).toHaveLength(1)
expect(app.visitedTabs[0]).toMatchObject({ key: '/dashboard', closable: false })
})
@@ -36,7 +36,7 @@ describe('app store · 主题与布局', () => {
expect(app.darkMode).toBe(false)
})
it('setPrimary / toggleSidebar / setSidebar / toggleLocale', () => {
it('setPrimary / toggleSidebar / setSidebar', () => {
createTestPinia()
const app = useAppStore()
app.setPrimary('#123456')
@@ -45,8 +45,15 @@ describe('app store · 主题与布局', () => {
expect(app.sidebarCollapsed).toBe(true)
app.setSidebar(false)
expect(app.sidebarCollapsed).toBe(false)
app.toggleLocale()
expect(app.locale).toBe('en-US')
})
it('i18n store 管理界面语言切换', () => {
createTestPinia()
const i18n = useI18nStore()
i18n.setLocale('zh-CN')
expect(i18n.locale).toBe('zh-CN')
i18n.toggleLocale()
expect(i18n.locale).toBe('en-US')
})
})