66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { compileWireFile } from "../../compiler/src/index.ts";
|
|
import { uiComponentNames, uiComponentsDir, uiCss } from "../src/index.ts";
|
|
|
|
test("bundled UI assets are discoverable and readable", () => {
|
|
expect(uiComponentNames()).toContain("Button");
|
|
expect(uiComponentNames()).toContain("FAQAccordion");
|
|
expect(uiComponentNames()).toContain("AnnouncementBar");
|
|
expect(uiComponentNames()).toContain("BackToTop");
|
|
expect(readFileSync(join(uiComponentsDir(), "Button.wrn"), "utf8")).toContain("component Button");
|
|
expect(uiCss()).toContain("--wire-");
|
|
});
|
|
|
|
test("PDF minimum-release and essential build-first components are bundled", () => {
|
|
const required = [
|
|
"Typography",
|
|
"Form",
|
|
"FormLabel",
|
|
"FormHelpText",
|
|
"FormError",
|
|
"LoadingButton",
|
|
"Combobox",
|
|
"MultiSelect",
|
|
"TimePicker",
|
|
"DateTimePicker",
|
|
"RecurringSchedulePicker",
|
|
"QuietHoursPicker",
|
|
"ConfirmationDialog",
|
|
"DataTable",
|
|
"FilterBar",
|
|
"MegaMenu",
|
|
"DesktopNavigation",
|
|
"ProductsMegaMenu",
|
|
"MobileNavigation",
|
|
"MarketingPageShell",
|
|
"ProductPageShell",
|
|
"LegalPageShell",
|
|
"ProductCard",
|
|
"MetricGrid",
|
|
"FAQ",
|
|
"PricingComparisonTable",
|
|
"SDKTabs",
|
|
"LegalTableOfContents",
|
|
"CookiePreferencesDialog",
|
|
];
|
|
|
|
expect(uiComponentNames()).toEqual(expect.arrayContaining(required));
|
|
});
|
|
|
|
test("component-system CSS includes responsive, theme-token, focus, and reduced-motion rules", () => {
|
|
const css = uiCss();
|
|
expect(css).toContain("@media (max-width: 768px)");
|
|
expect(css).toContain("@media (max-width: 480px)");
|
|
expect(css).toContain("@media (prefers-reduced-motion: reduce)");
|
|
expect(css).toContain(":focus-visible");
|
|
expect(css).toContain("var(--wire-color-surface)");
|
|
expect(css).toContain("min-height: 44px");
|
|
});
|
|
|
|
test.each(uiComponentNames())("bundled UI component %s compiles", (name) => {
|
|
const path = join(uiComponentsDir(), `${name}.wrn`);
|
|
expect(() => compileWireFile(readFileSync(path, "utf8"), path)).not.toThrow();
|
|
});
|