docs: UI-02 acceptance record and visual verification

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-21 23:10:58 +08:00
parent 160e7e5f1a
commit 2a489aa16a
23 changed files with 297 additions and 75 deletions
@@ -432,6 +432,32 @@ describe('photo lightbox dark viewer (UI-02 V04)', () => {
trigger.remove();
});
// UI-02 Task 6 无障碍抽检(§5.3):Tab 循环困于对话框——两端折回,不穿透。
it('traps Tab focus inside the dialog (wrap-around at both ends)', async () => {
const wrapper = mountLightbox('p2');
document.body.appendChild(wrapper.element);
await flushPromises();
const focusables = Array.from(
wrapper.element.querySelectorAll('button:not([disabled])'),
).filter((el): el is HTMLElement => el instanceof HTMLElement);
expect(focusables.length).toBeGreaterThan(1);
const first = focusables[0]!;
const last = focusables[focusables.length - 1]!;
// 末元素正向 Tab → 折回首元素。
last.focus();
last.dispatchEvent(new KeyboardEvent('keydown', { key: 'Tab', bubbles: true, cancelable: true }));
expect(document.activeElement).toBe(first);
// 首元素 Shift+Tab → 折回末元素。
first.focus();
first.dispatchEvent(
new KeyboardEvent('keydown', { key: 'Tab', shiftKey: true, bubbles: true, cancelable: true }),
);
expect(document.activeElement).toBe(last);
});
it('locks body scroll while open and restores the previous value on close', async () => {
document.body.style.overflow = 'auto';
const wrapper = mountLightbox('p2');
@@ -454,6 +480,16 @@ describe('photo lightbox dark viewer (UI-02 V04)', () => {
expect(source).toContain('env(safe-area-inset-top, 0px)');
expect(source).toContain('env(safe-area-inset-bottom, 0px)');
});
it('layers the fullscreen overlay above the sticky topbar (close button clickable)', () => {
// jsdom 无布局:源级断言(同上)。覆盖层 z=200 须高于 sticky 顶栏 z=120
// (App.vue)——否则顶栏盖住关闭按钮的可点区(e2e 曾拦截 click 的真实回归)。
const source = readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '..', 'components', 'PhotoLightbox.vue'),
'utf8',
);
expect(source).toMatch(/\.photo-viewer\s*\{[^}]*z-index:\s*200/s);
});
});
describe('photo lightbox interactions (UI-02 V05)', () => {