Refresh UI components and showcase; release updated framework packages
This commit is contained in:
1 parent
d800228585
commit
c77f5e1cec
293 files changed
+22544
-35778
No files matched your search
@@ -1,6 +1,21 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { renderDocument, renderDocumentStream, renderStoreHydration } from "../src/index.ts";
|
||||
import type { StoreContainer } from "@wrnexus/store";
|
||||
import { runWithRequestContext, encodeControlTemplate } from "@wrnexus/core";
|
||||
|
||||
test("streamed documents include templates registered by late body chunks", async () => {
|
||||
await runWithRequestContext({} as never, async () => {
|
||||
async function* body() {
|
||||
yield "<p>Shell</p>";
|
||||
await Promise.resolve();
|
||||
yield `<template data-wrn-if="${encodeControlTemplate([{ cond: null, body: "Late" }])}"></template>`;
|
||||
}
|
||||
const html = await new Response(renderDocumentStream({ meta: {}, body: body() })).text();
|
||||
expect(html).toContain('data-wrn-controls');
|
||||
expect(html).toContain('"body":"Late"');
|
||||
expect(html.match(/data-wrn-controls/g)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
test("store hydration is HTML-safe, bounded, redacted, and JSON-compatible", () => {
|
||||
const container = {
|
||||
|
||||
Reference in new issue
Block a user