[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
@@ -215,6 +215,8 @@ exports[`misc other complex template 1`] = `
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`search_input\`] = el;
const ref2 = (el) => refs[\`settings_menu\`] = el;
let b2,b4,b14,b17,b22,b23,b24,b25;
let attr1 = \`/runbot/\${ctx['project'].slug}\`;
let txt1 = ctx['project'].name;
@@ -275,9 +277,7 @@ exports[`misc other complex template 1`] = `
let attr8 = ctx['search'].value;
let hdlr4 = [ctx['updateFilter'], ctx];
let hdlr5 = [ctx['updateFilter'], ctx];
let d1 = (el) => refs[\`search_input\`] = el;
let hdlr6 = [ctx['clearSearch'], ctx];
let d2 = (el) => refs[\`settings_menu\`] = el;
if (ctx['triggers']) {
ctx = Object.create(ctx);
const [k_block18, v_block18, l_block18, c_block18] = prepareList(ctx['triggers']);
@@ -320,7 +320,7 @@ exports[`misc other complex template 1`] = `
let b27 = component(\`BundlesList\`, {bundles: ctx['bundles'].dev,search: ctx['search']}, key + \`__3\`, node, ctx);
b25 = block25([], [b26, b27]);
}
return block1([attr1, txt1, hdlr2, hdlr3, attr8, hdlr4, hdlr5, d1, hdlr6, d2], [b2, b4, b14, b17, b22, b23, b24, b25]);
return block1([attr1, txt1, hdlr2, hdlr3, attr8, hdlr4, hdlr5, ref1, hdlr6, ref2], [b2, b4, b14, b17, b22, b23, b24, b25]);
}
}"
`;
+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]);
}
}"
`;