import { describe, it, expect } from "vitest"; import { Hono } from "hono"; import { PageHeader } from "../page-header.js"; describe("PageHeader", () => { it("renders title in h1 with page-header class", async () => { const app = new Hono().get("/", (c) => c.html() ); const res = await app.request("/"); const html = await res.text(); expect(html).toContain('class="page-header"'); expect(html).toContain(" { const app = new Hono().get("/", (c) => c.html() ); const res = await app.request("/"); const html = await res.text(); expect(html).toContain("A description"); }); it("omits description element when not provided", async () => { const app = new Hono().get("/", (c) => c.html() ); const res = await app.request("/"); const html = await res.text(); expect(html).not.toMatch(/]*>\s*<\/p>/); }); it("renders action slot when provided", async () => { const app = new Hono().get("/", (c) => c.html( New Topic} /> ) ); const res = await app.request("/"); const html = await res.text(); expect(html).toContain('class="page-header__action"'); expect(html).toContain("New Topic"); }); });