Expose reusable builder kit surfaces and email preset pack
Quality / quality (ubuntu-latest) (push) Failing after 10m2s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
Clintchiz committed 2026-09-05 19:51:57 +05:30
1 parent e019ac34c8
commit eb1875f0bc
20 files changed
+635 -4

No files matched your search

@@ -0,0 +1,20 @@
import { expect, test } from "bun:test";
import type { BlockNode } from "@wrnexus/blocks";
import { builderOutlineLabel } from "../src/outline.ts";
const node = (props: BlockNode["props"], type = "content.button"): BlockNode => ({ id: "n", type, version: 1, props, styles: {}, slots: {} });
test("outline uses registered names and distinguishes content without mutating it", () => {
const block = node({ label: " Buy\n now " });
expect(builderOutlineLabel(block, { name: { fallback: "Button" } })).toBe("Button — Buy now");
expect(block.props.label).toBe(" Buy\n now ");
expect(builderOutlineLabel(node({ width: "35%" }, "layout.column"), { name: { fallback: "Column" } })).toBe("Column — 35%");
expect(builderOutlineLabel(node({}, "custom.unknown"))).toBe("custom.unknown");
});
test("outline bounds Unicode snippets and treats content as plain text", () => {
const label = builderOutlineLabel(node({ label: "😀".repeat(65) }), { name: { fallback: "Button" } });
expect(label).toBe("Button — " + "😀".repeat(64) + "…");
expect(builderOutlineLabel(node({ label: '<img onerror="bad">' }))).toContain('<img onerror="bad">');
expect(builderOutlineLabel(node({ text: {}, label: "", title: "Product title" }))).toBe("content.button — Product title");
});