release: WRNexusJS 0.8.0
This commit is contained in:
@@ -7,6 +7,27 @@ import { generate, parse } from "../src/index.ts";
|
||||
import { compileWireFile } from "../src/index.ts";
|
||||
import { mountHtml } from "@wrnexus/test";
|
||||
|
||||
test("explicit static rendering disables hydration metadata", () => {
|
||||
const output = compileWireFile(`page StaticPage {
|
||||
render = "static"
|
||||
state count = 0
|
||||
view { <button @click="count++">{count}</button> }
|
||||
}`);
|
||||
expect(output).toContain('export const __wrnexusRender = "static"');
|
||||
expect(output).toContain('data-wrn-hydrate="none"');
|
||||
expect(output).toContain('export const __wrnexusHydrate = "none"');
|
||||
});
|
||||
|
||||
test("named data loads compile as parallel typed data entries", () => {
|
||||
const output = compileWireFile(`page Users {
|
||||
load users { return ["Ada"] }
|
||||
load server teams { return ["Core"] }
|
||||
view { <p>Users</p> }
|
||||
}`);
|
||||
expect(output).toContain("await Promise.all");
|
||||
expect(output).toContain('return { "users": __values[0], "teams": __values[1] }');
|
||||
});
|
||||
|
||||
let seq = 0;
|
||||
/** Compile a `.wrn` source and import the resulting module. */
|
||||
async function compileAndImport(src: string): Promise<Record<string, unknown>> {
|
||||
|
||||
Reference in New Issue
Block a user