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,6 @@
|
||||
{
|
||||
"name": "@wrnexus/test",
|
||||
"version": "0.8.15",
|
||||
"version": "0.8.16",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
||||
@@ -61,7 +61,13 @@ export async function renderComponent(
|
||||
const dir = join(tmpdir(), "wrnexus-test");
|
||||
mkdirSync(dir, { recursive: true });
|
||||
const file = join(dir, `c${seq++}.ts`);
|
||||
writeFileSync(file, compileWrnFile(source, file), "utf8");
|
||||
// Temp files otherwise resolve bare imports against the OS temp directory,
|
||||
// potentially picking up an unrelated global framework installation.
|
||||
const code = compileWrnFile(source, file).replace(
|
||||
/from (["'])@wrnexus\/core\1/g,
|
||||
`from ${JSON.stringify(import.meta.resolve("@wrnexus/core"))}`,
|
||||
);
|
||||
writeFileSync(file, code, "utf8");
|
||||
const mod = (await import(pathToFileURL(file).href)) as {
|
||||
render?: (props: Record<string, unknown>) => string;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,15 @@ import {
|
||||
createFetchMock,
|
||||
createTestContext,
|
||||
} from "../src/index.ts";
|
||||
import { runWithRequestContext, renderControlTemplates } from "@wrnexus/core";
|
||||
|
||||
test("temporary component modules use the same core request context as the caller", async () => {
|
||||
await runWithRequestContext({} as never, async () => {
|
||||
const html = await renderComponent(`component Conditional {\n state open = true\n view { {#if open}<p>Visible</p>{/if} }\n }`);
|
||||
expect(html).toContain('data-wrn-if="@wrn-controls-');
|
||||
expect(renderControlTemplates()).toContain("Visible");
|
||||
});
|
||||
});
|
||||
|
||||
const COUNTER = `component Counter {
|
||||
props {
|
||||
|
||||
Reference in new issue
Block a user