[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,13 +10,13 @@ exports[`hooks autofocus hook input in a t-if 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`input1\`] = el;
const ref2 = (el) => refs[\`input2\`] = el;
let b2;
let d1 = (el) => refs[\`input1\`] = el;
if (ctx['state'].flag) {
let d2 = (el) => refs[\`input2\`] = el;
b2 = block2([d2]);
b2 = block2([ref2]);
}
return block1([d1], [b2]);
return block1([ref1], [b2]);
}
}"
`;
@@ -30,9 +30,9 @@ exports[`hooks autofocus hook simple input 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
let d1 = (el) => refs[\`input1\`] = el;
let d2 = (el) => refs[\`input2\`] = el;
return block1([d1, d2]);
const ref1 = (el) => refs[\`input1\`] = el;
const ref2 = (el) => refs[\`input2\`] = el;
return block1([ref1, ref2]);
}
}"
`;
@@ -206,10 +206,10 @@ exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`div\`] = el;
let b2;
if (ctx['state'].value) {
let d1 = (el) => refs[\`div\`] = el;
b2 = block2([d1]);
b2 = block2([ref1]);
}
return multi([b2]);
}
@@ -281,9 +281,9 @@ exports[`hooks useRef hook: basic use 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
let d1 = (el) => refs[\`button\`] = el;
const ref1 = (el) => refs[\`button\`] = el;
let txt1 = ctx['value'];
return block1([d1, txt1]);
return block1([ref1, txt1]);
}
}"
`;