release: WRNexusJS 0.2.44
This commit is contained in:
@@ -839,3 +839,37 @@ component FAQAccordion {
|
||||
|
||||
expect(output).toContain("isOpen(index)");
|
||||
});
|
||||
test("data-for conditional classes do not evaluate loop variables during SSR", () => {
|
||||
const output = generate(
|
||||
parse(`
|
||||
component Accordion {
|
||||
props {
|
||||
items = []
|
||||
}
|
||||
|
||||
state openIndexes = []
|
||||
|
||||
functions {
|
||||
function isOpen(index) {
|
||||
return openIndexes.includes(index)
|
||||
}
|
||||
}
|
||||
|
||||
view {
|
||||
<article
|
||||
data-for="item, index in items"
|
||||
class:open="isOpen(index)"
|
||||
>
|
||||
{item.title}
|
||||
</article>
|
||||
}
|
||||
}
|
||||
`),
|
||||
);
|
||||
|
||||
expect(output).toContain('data-for="item, index in items"');
|
||||
|
||||
expect(output).toContain("data-wrn-class-0");
|
||||
|
||||
expect(output).not.toContain('${(isOpen(index)) ? " open" : ""}');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user