release: WRNexusJS 0.3.0

This commit is contained in:
2026-07-22 17:29:08 +05:30
parent 13dfa31d19
commit 07d8fb59d6
145 changed files with 9664 additions and 3881 deletions
+12 -1
View File
@@ -1,5 +1,5 @@
import { expect, test } from "bun:test";
import { renderDocument } from "../src/index.ts";
import { renderDocument, renderDocumentStream } from "../src/index.ts";
test("escapes metadata and script URLs while preserving trusted rendered body", () => {
const html = renderDocument({
@@ -35,3 +35,14 @@ test("always emits a document language and preserves an explicit language", () =
expect(explicit).toContain('<html data-theme="dark" lang="fr">');
expect(explicit).not.toContain('lang="en"');
});
test("streams async body chunks inside the document shell", async () => {
async function* body() {
yield "<h1>Shell</h1>";
yield "<p>Later</p>";
}
const html = await new Response(
renderDocumentStream({ meta: { title: "Stream" }, body: body() }),
).text();
expect(html).toContain('<div id="app"><h1>Shell</h1><p>Later</p></div>');
});