[FIX] components: make sure t-ref work with t-if/t-else

This commit is contained in:
Géry Debongnie
2021-12-22 08:52:51 +01:00
committed by Aaron Bohy
parent 9f2e2bcc66
commit 92cc4375f8
9 changed files with 160 additions and 33 deletions
+10 -10
View File
@@ -25,8 +25,8 @@ exports[`t-ref can get a ref on a node 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
let d1 = (el) => refs[\`myspan\`] = el;
return block1([d1]);
const ref1 = (el) => refs[\`myspan\`] = el;
return block1([ref1]);
}
}"
`;
@@ -56,8 +56,8 @@ exports[`t-ref ref in a t-call 2`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
let d1 = (el) => refs[\`name\`] = el;
return block1([d1]);
const ref1 = (el) => refs[\`name\`] = el;
return block1([ref1]);
}
}"
`;
@@ -72,10 +72,10 @@ exports[`t-ref ref in a t-if 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`name\`] = el;
let b2;
if (ctx['condition']) {
let d1 = (el) => refs[\`name\`] = el;
b2 = block2([d1]);
b2 = block2([ref1]);
}
return block1([], [b2]);
}
@@ -120,13 +120,13 @@ exports[`t-ref two refs, one in a t-if 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`name\`] = el;
const ref2 = (el) => refs[\`p\`] = el;
let b2;
if (ctx['condition']) {
let d1 = (el) => refs[\`name\`] = el;
b2 = block2([d1]);
b2 = block2([ref1]);
}
let d2 = (el) => refs[\`p\`] = el;
return block1([d2], [b2]);
return block1([ref2], [b2]);
}
}"
`;