release: WRNexusJS 0.2.38
This commit is contained in:
@@ -243,7 +243,9 @@ component ParentCard {
|
||||
|
||||
expect(output).toContain('data-component="ChildCard"');
|
||||
|
||||
expect(output).toContain('title="${__wireAttr(title)}"');
|
||||
expect(output).toContain('title="${__wireProp(title)}"');
|
||||
|
||||
expect(output).toContain("function __wireProp");
|
||||
});
|
||||
|
||||
test("parses a layout block", () => {
|
||||
@@ -737,3 +739,47 @@ component Banner {
|
||||
expect(output).toContain("Visible");
|
||||
expect(output).toContain("Hidden");
|
||||
});
|
||||
test("component array props support each blocks", () => {
|
||||
const output = generate(
|
||||
parse(`
|
||||
component HighlightList {
|
||||
props {
|
||||
highlights = []
|
||||
}
|
||||
|
||||
view {
|
||||
{#each highlights as highlight}
|
||||
<p>{highlight.title}</p>
|
||||
{/each}
|
||||
}
|
||||
}
|
||||
`),
|
||||
);
|
||||
|
||||
expect(output).toContain("Array.isArray(def)");
|
||||
|
||||
expect(output).toContain("JSON.parse(v)");
|
||||
|
||||
expect(output).toContain("highlights");
|
||||
});
|
||||
test("page component props evaluate whole expressions", () => {
|
||||
const output = generate(
|
||||
parse(`
|
||||
page Home {
|
||||
view {
|
||||
<HighlightList
|
||||
enabled="{true}"
|
||||
highlights="{[
|
||||
{ title: 'First' },
|
||||
{ title: 'Second' }
|
||||
]}"
|
||||
/>
|
||||
}
|
||||
}
|
||||
`),
|
||||
);
|
||||
|
||||
expect(output).toContain("__wrnexusPropAttr(true)");
|
||||
|
||||
expect(output).toContain("__wrnexusPropAttr([");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user