Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"check:bundle": "node scripts/check-bundle-size.mjs"
},
"dependencies": {
"@lumencast/runtime": "^0.1.0",
"@lumencast/runtime": "^0.2.0",
"@preact/signals-react": "^3.2.1",
"framer-motion": "^12.0.0",
"react": "^19.0.0",
Expand Down
36 changes: 36 additions & 0 deletions tests/unit/render.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,42 @@ describe("Solar mount() over @lumencast/runtime", () => {
target.remove();
});

it("renders text fontFamily (resolved.font) and image intrinsic width/height", async () => {
const target = document.createElement("div");
document.body.appendChild(target);
// Render-vocab bundle (what Orion's lowerRenderProps serves): text.font +
// image.width/height. Proves the runtime fixes — text.tsx applies
// fontFamily, image.tsx honours width/height instead of forcing 100%.
const bundle: RenderBundle = {
scene_version: SCENE_VERSION,
root: {
kind: "stack",
children: [
{ kind: "text", id: "t", props: { value: "FONT", font: "Bebas Neue", size: 48 } },
{ kind: "image", id: "i", props: { src: "http://x/logo.svg", width: 96, height: 64, fit: "contain" } },
],
},
};
vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify(bundle), { status: 200 })));
vi.stubGlobal("WebSocket", FakeWebSocket as unknown as typeof WebSocket);

const handle = mount({
target, orionUrl: "wss://gate.example/orion/api/v1/show/stream",
token: "t", mode: "broadcast",
});
await waitFor(() => target.querySelector("img") !== null && target.textContent?.includes("FONT") === true);

const span = target.querySelector("span");
const img = target.querySelector("img") as HTMLImageElement | null;
expect(span?.style.fontFamily).toContain("Bebas Neue");
expect(img?.style.width).toBe("96px");
expect(img?.style.height).toBe("64px");
expect(img?.getAttribute("src")).toBe("http://x/logo.svg");

handle.disconnect();
target.remove();
});

it("maps orionUrl onto the runtime serverUrl (WS opened against it)", async () => {
const target = document.createElement("div");
document.body.appendChild(target);
Expand Down
Loading