|
|
|
@@ -100,20 +100,15 @@ test('compare chart on mobile shows school chips with tap-to-focus', async ({ pa
|
|
|
|
|
links.map((l) => (l as HTMLAnchorElement).getAttribute('href') || '')
|
|
|
|
|
);
|
|
|
|
|
const urns = [...new Set(hrefs.map((h) => h.match(/\/school\/(\d+)/)?.[1]).filter(Boolean))];
|
|
|
|
|
// Compare three schools, not two: a "primary" search can return all-through
|
|
|
|
|
// schools that classify as secondary, and the chips only appear for the
|
|
|
|
|
// active phase. With three schools across two phases, the auto-selected
|
|
|
|
|
// majority phase always holds ≥2, so the chip legend is guaranteed to render.
|
|
|
|
|
expect(urns.length).toBeGreaterThanOrEqual(3);
|
|
|
|
|
expect(urns.length).toBeGreaterThanOrEqual(2);
|
|
|
|
|
|
|
|
|
|
await page.goto(`/compare?urns=${urns[0]},${urns[1]},${urns[2]}`);
|
|
|
|
|
await page.goto(`/compare?urns=${urns[0]},${urns[1]}`);
|
|
|
|
|
await expect(page.locator('canvas:visible').first()).toBeVisible({ timeout: 15_000 });
|
|
|
|
|
|
|
|
|
|
// The mobile chart legend renders one chip per school in the active phase.
|
|
|
|
|
// The mobile chart legend renders one chip per school inside the chart card.
|
|
|
|
|
const chipGroup = page.getByRole('group', { name: /highlight a school/i });
|
|
|
|
|
const chips = chipGroup.getByRole('button');
|
|
|
|
|
await expect(chips.first()).toBeVisible({ timeout: 15_000 });
|
|
|
|
|
expect(await chips.count()).toBeGreaterThanOrEqual(2);
|
|
|
|
|
await expect(chips).toHaveCount(2);
|
|
|
|
|
|
|
|
|
|
// Tapping a chip focuses that school's line; tapping again releases it.
|
|
|
|
|
await chips.first().click();
|
|
|
|
|