/** RFC-0026: icons in surfaces, drawn from the curated set. */ import type { SurfaceComponent, SurfaceSection } from "@cloudhal/core-contracts"; import { describe, expect, it } from "vitest"; import { renderSurface } from "../src/surfaces.ts"; const surface = (components: SurfaceComponent[]): SurfaceSection => ({ id: "sec_icons00001", kind: "surface", catalog: "blog@1", components: components as SurfaceSection["components"], }); describe("icons in surfaces (RFC-0026)", () => { const html = renderSurface( surface([ { id: "root", component: "Stack", children: ["i", "a", "b", "g", "s", "l"] }, { id: "i", component: "Icon", props: { name: "rocket", size: "l", tone: "brand" } }, { id: "a", component: "Icon", props: { name: "warning", label: "Careful" } }, { id: "b", component: "Button", props: { label: "Next", href: "/next", icon: "arrow-right", iconPosition: "end" }, }, { id: "g", component: "Badge", props: { label: "New", icon: "sparkle" } }, { id: "s", component: "Stat", props: { value: "12", label: "Countries", icon: "globe" } }, { id: "l", component: "List", props: { items: ["Fast", "Safe"], marker: "check" } }, ]), ); it("draws decorative icons, a named one when it stands alone, and icons after a label", () => { expect(html).toContain( 'Next]*aria-hidden="true"/, ); expect(html).toContain(' { expect(html).toContain( '
  • a
'); }); });