1import { render } from "npm:preact-render-to-string@6.7.0";2import { getNoticeQueue } from "../runtime/mod.ts";3import { Notices } from "./Notices.tsx";45Deno.test("Notices keeps its empty live region exposed for the first announcement", () => {6 const html = render(<Notices />);7 if (!html.includes('aria-live="polite"')) {8 throw new Error("the durable notice surface omitted its live region");9 }10 if (html.includes(" hidden")) {11 throw new Error("an empty live region must remain in the accessibility tree");12 }13});1415Deno.test("Notices preserves custom renderer markup without a wrapper", async () => {16 const queue = getNoticeQueue();17 const id = "notices-custom-renderer-test";18 await queue.enqueue({ id, message: "Custom", tone: "info", ttlMs: null });19 try {20 const html = render(21 <Notices>{(notice) => <article data-notice={notice.id}>{notice.message}</article>}</Notices>,22 );23 if (!html.includes(`<article data-notice="${id}">Custom</article>`)) {24 throw new Error("the custom notice renderer did not retain its own root markup");25 }26 if (html.includes("<div")) {27 throw new Error("the notices surface inserted a wrapper around custom markup");28 }29 } finally {30 queue.dismiss(id);31 await queue.flush();32 }33});