import { describe, it, expect } from "vitest"; import fs from "fs"; import path from "path"; const indexHtml = fs.readFileSync(path.join(__dirname, "../../public/src/index.html"), "utf-8"); describe("Modal accessibility attributes", () => { it("close buttons must have aria-label='Close'", () => { // All close buttons in modals should have aria-label="Close" const closeButtons = indexHtml.match(/]*class="close"[^>]*>/g) || []; expect(closeButtons.length).toBeGreaterThan(0); for (const btn of closeButtons) { expect(btn).toContain('aria-label="Close"'); } }); it("modal overlays with role='dialog' must have aria-modal='true'", () => { const dialogs = indexHtml.match(/]*role="dialog"[^>]*>/g) || []; expect(dialogs.length).toBeGreaterThan(0); for (const dialog of dialogs) { expect(dialog).toContain('aria-modal="true"'); } }); });