docs: UI-02 acceptance record and visual verification
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -53,4 +53,26 @@ describe('viewer i18n', () => {
|
||||
expect(wrapper.text()).toContain('打开相册链接即可观看');
|
||||
expect(localStorage.getItem(LOCALE_STORAGE_KEY)).toBe('zh-CN');
|
||||
});
|
||||
|
||||
// UI-02 Task 6(V05 §5.4 分享链路闭环):分享 URL 携带 ?lang=,接收端
|
||||
// 首载据此定语言——优先于本地持久化偏好;不合法值(fr/auto)自然回退。
|
||||
it('initial locale honors the ?lang= share parameter over the stored preference', () => {
|
||||
localStorage.setItem(LOCALE_STORAGE_KEY, 'zh-CN');
|
||||
|
||||
window.history.pushState({}, '', '/a/token?lang=en');
|
||||
expect(createViewerI18n().global.locale.value).toBe('en');
|
||||
|
||||
// 非法/不支持值:回落到持久化偏好。
|
||||
window.history.pushState({}, '', '/a/token?lang=auto');
|
||||
expect(createViewerI18n().global.locale.value).toBe('zh-CN');
|
||||
window.history.pushState({}, '', '/a/token?lang=fr');
|
||||
expect(createViewerI18n().global.locale.value).toBe('zh-CN');
|
||||
|
||||
// 无参数:持久化偏好照旧生效。
|
||||
window.history.pushState({}, '', '/a/token');
|
||||
expect(createViewerI18n().global.locale.value).toBe('zh-CN');
|
||||
|
||||
// 参数不写 localStorage——接收者未做选择,显式切换才持久化。
|
||||
expect(localStorage.getItem(LOCALE_STORAGE_KEY)).toBe('zh-CN');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user