Files
SubTracker/apps/web/tests/unit/components/app-layout.test.ts
SmileQWQ b88659062a feat: unify app locale persistence and bootstrap flow
- add a dedicated app locale endpoint and move locale persistence from settings to appLocale with env-based defaults

- sync the app shell and login bootstrap flow against the resolved backend locale while keeping localStorage only as a cache

- reject locale updates through PATCH /settings and cover the migration and locale route behavior with regression tests
2026-05-17 20:55:28 +08:00

37 lines
1.8 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { describe, expect, it } from 'vitest'
describe('app layout sidebar behavior', () => {
it('keeps desktop sidebar fixed and menu independently scrollable', () => {
const source = readFileSync('src/App.vue', 'utf8')
const globalStyle = readFileSync('src/style.css', 'utf8')
const html = readFileSync('index.html', 'utf8')
expect(source).toContain('content-style="overflow: visible;"')
expect(source).toContain('class="desktop-sider"')
expect(source).toContain('const appVersion = __APP_VERSION__')
expect(source).toContain('position: sticky;')
expect(source).toContain('height: 100vh;')
expect(source).toContain('overflow: visible;')
expect(source).toContain('align-self: flex-start;')
expect(source).toContain('overflow-y: auto;')
expect(source).toContain("v-model:value=\"currentLocale\"")
expect(source).toContain("@update:value=\"handleLocaleChange\"")
expect(source).toContain("v-if=\"!siderCollapsed\"")
expect(source).toContain('await api.setAppLocale(nextLocale)')
expect(source).toContain('setLocale(previousLocale)')
expect(source).toContain('class="locale-select"')
expect(source).toContain('class="main-content"')
expect(source).not.toContain('height: calc(100vh - 64px);')
expect(source).not.toContain('.main-content :deep(.n-layout-scroll-container)')
expect(source).not.toContain('.theme-toggle--floating')
expect(source).not.toContain('.theme-fab-shell')
expect(globalStyle).toContain(":root[data-theme='dark']")
expect(globalStyle).toContain('background: #111827;')
expect(globalStyle).toContain('#app {')
expect(globalStyle).toContain('background: var(--app-bg);')
expect(html).toContain('rel="icon"')
expect(html).toContain('/src/assets/brand-logo.png')
})
})