feat(wrn): support native structured prop expressions

This commit is contained in:
2026-07-29 16:46:18 +05:30
parent 6afe32f63f
commit 8fc6f15402
68 changed files with 210 additions and 118 deletions
+22
View File
@@ -464,6 +464,28 @@ component ParentCard {
expect(output).toContain("function __wireProp");
});
test("native array and object props serialize through component mounts", async () => {
const mod = await compileAndImport(`
component NativeProps {
state items = [{"label":"Home","href":"/"}]
view {
<Navbar items={items} options={{"dense":true}} />
<Sidebar items={[{"label":"Cases","href":"/cases"}]} />
}
}
`);
const render = mod.render as (props?: Record<string, unknown>) => string;
const html = render();
expect(html).toContain(
'items="[{&quot;label&quot;:&quot;Home&quot;,&quot;href&quot;:&quot;/&quot;}]"',
);
expect(html).toContain('options="{&quot;dense&quot;:true}"');
expect(html).toContain(
'items="[{&quot;label&quot;:&quot;Cases&quot;,&quot;href&quot;:&quot;/cases&quot;}]"',
);
});
test("parses a layout block", () => {
const ast = parse(`
layout AppLayout {