test(a11y): add A4a-A4b photo strip keyboard tests
This commit is contained in:
@@ -52,3 +52,27 @@ test('A3d: clicking Stats toggle sets aria-expanded="true" then back to false',
|
||||
await page.click('#trip-stats-toggle');
|
||||
await expect(page.locator('#trip-stats-toggle')).toHaveAttribute('aria-expanded', 'false');
|
||||
});
|
||||
|
||||
// ── A4: Photo strip keyboard navigation ───────────────────────────────────────
|
||||
test('A4a: all photo strips have role=region and aria-label', async ({ page }) => {
|
||||
await page.goto('/trips/japan-korea-2026/dailies');
|
||||
const strips = page.locator('.journal-photo-strip');
|
||||
const count = await strips.count();
|
||||
if (count === 0) return;
|
||||
for (let i = 0; i < count; i++) {
|
||||
await expect(strips.nth(i)).toHaveAttribute('role', 'region');
|
||||
await expect(strips.nth(i)).toHaveAttribute('aria-label', 'Photo strip');
|
||||
}
|
||||
});
|
||||
|
||||
test('A4b: multi-slide photo strips have accessible prev/next controls', async ({ page }) => {
|
||||
await page.goto('/trips/japan-korea-2026/dailies');
|
||||
const multiCount = await page.locator('.journal-photo-strip').evaluateAll(
|
||||
els => els.filter(el => parseInt(el.dataset.slides, 10) >= 2).length
|
||||
);
|
||||
if (multiCount === 0) return;
|
||||
await expect(page.locator('.strip-prev').first()).toBeAttached();
|
||||
await expect(page.locator('.strip-next').first()).toBeAttached();
|
||||
await expect(page.locator('.strip-prev').first()).toHaveAttribute('aria-label', 'Previous photo');
|
||||
await expect(page.locator('.strip-next').first()).toHaveAttribute('aria-label', 'Next photo');
|
||||
});
|
||||
|
||||
+1
-1
Submodule user updated: ce5d520817...f463eadbef
Reference in New Issue
Block a user