[FIX] compiler: t-key on a sub-domnode pushes an anchor in parent block

This commit is contained in:
Lucas Perais (lpe)
2022-01-20 16:26:05 +01:00
committed by Géry Debongnie
parent 45f6a8e97a
commit 055cbda750
3 changed files with 56 additions and 1 deletions
@@ -68,3 +68,38 @@ exports[`t-key t-key directive in a list 1`] = `
}
}"
`;
exports[`t-key t-key on sub dom node pushes a child block in its parent 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
let block2 = createBlock(\`<span/>\`);
let block3 = createBlock(\`<div><h1/></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (ctx['hasSpan']) {
b2 = block2();
}
const tKey_1 = ctx['key'];
b3 = toggler(tKey_1, block3());
return block1([], [b2, b3]);
}
}"
`;
exports[`t-key t-key on sub dom node pushes a child block in its parent 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div><h1/></div>\`);
return function template(ctx, node, key = \\"\\") {
const tKey_1 = ctx['key'];
return toggler(tKey_1, block1());
}
}"
`;