test(quick-261016-0fm): theme switch, language switcher and footer offset

- theme: light and dark ignore prefers-color-scheme, choices and guard
- i18n: ?locale= only with a preference, availableLocales from meta
- usePreferences: cache validation, cycle order and PUT bodies, revert
  with a danger toast, profile apply, setLocale save, cache and reload
- rail theme button, user menu language group, --shell-offset and the
  form save bar offset; fixture strings and resetState theme reset
This commit is contained in:
Jakub Zych
2026-10-16 11:48:39 +02:00
parent 119f1f8d54
commit f0ab26b93f
9 changed files with 416 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ import App from '../src/App.vue'
import { createAdminRouter } from '../src/app/router'
import { setBundle } from '../src/app/i18n'
import { clearUser, me } from '../src/state/useAuth'
import { applyProfilePreferences } from '../src/state/usePreferences'
import { clearRecordCrumb } from '../src/state/useBreadcrumbs'
import { loadNavigation, setNavigation } from '../src/state/useNavigation'
import { setSettings } from '../src/state/useSettings'
@@ -158,7 +159,7 @@ export function fakeMedia(initial: Record<string, boolean>) {
}
}
/** Module state back to a signed-out, Polish-strings start. */
/** Module state back to a signed-out, Polish-strings, system-theme start. */
export function resetState(): void {
clearUser()
setNavigation([])
@@ -166,6 +167,9 @@ export function resetState(): void {
clearToasts()
clearRecordCrumb()
setBundle(langFixture.data, 'pl')
// Theme back to system and no stored admin language (runs synchronously:
// an empty locale never awaits).
void applyProfilePreferences(profile.data)
window.localStorage.clear()
// Re-reads the (cleared) preference and the desktop viewport of setup.ts,
// so a narrow or collapsed sidebar never leaks into the next test.