[IMP] qweb: compiler: support t-key on node and component without t-foreach

This commit is contained in:
Lucas Perais (lpe)
2021-11-04 13:46:49 +01:00
committed by Aaron Bohy
parent 16f1e2c237
commit 7c04cc425e
19 changed files with 722 additions and 64 deletions
@@ -581,7 +581,8 @@ exports[`basics reconciliation alg is not confused in some specific situation 2`
return function template(ctx, node, key = \\"\\") {
let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
let b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx);
const tKey_2 = 4;
let b3 = toggler(tKey_2, component(\`Child\`, {}, tKey_2 + key + \`__3\`, node, ctx));
return block1([], [b2, b3]);
}
}"
@@ -640,8 +641,10 @@ exports[`basics same t-keys in two different places 2`] = `
let block1 = createBlock(\`<div><div><block-child-0/></div><div><block-child-1/></div></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2 = component(\`Child\`, {blip: '1'}, key + \`__1\`, node, ctx);
let b3 = component(\`Child\`, {blip: '2'}, key + \`__2\`, node, ctx);
const tKey_1 = 1;
let b2 = toggler(tKey_1, component(\`Child\`, {blip: '1'}, tKey_1 + key + \`__2\`, node, ctx));
const tKey_3 = 1;
let b3 = toggler(tKey_3, component(\`Child\`, {blip: '2'}, tKey_3 + key + \`__4\`, node, ctx));
return block1([], [b2, b3]);
}
}"
@@ -889,14 +892,15 @@ exports[`basics t-key on a component with t-if, and a sibling component 2`] = `
let { text, createBlock, list, multi, html, toggler, component } = bdom;
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
let block1 = createBlock(\`<div><block-child-0/><block-child-0/><block-child-1/></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (false) {
b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
const tKey_1 = 'str';
b2 = toggler(tKey_1, component(\`Child\`, {}, tKey_1 + key + \`__2\`, node, ctx));
}
b3 = component(\`Child\`, {}, key + \`__2\`, node, ctx);
b3 = component(\`Child\`, {}, key + \`__3\`, node, ctx);
return block1([], [b2, b3]);
}
}"