mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[ADD] components: re-add a test for t-foreach directive
This commit is contained in:
committed by
Géry Debongnie
parent
642ecf0ccd
commit
55ef9ca116
@@ -280,3 +280,42 @@ exports[`list of components sub components with some state rendered in a loop 2`
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`list of components t-foreach with t-component, and update 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
||||
|
||||
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let d1 = ctx['state'].val;
|
||||
let d2 = ctx['props'].val;
|
||||
return block1([d1, d2]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`list of components t-foreach with t-component, and update 2`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
ctx = Object.create(ctx);
|
||||
const [k2, v2, l2, c2] = prepareList(Array(2));
|
||||
for (let i1 = 0; i1 < l2; i1++) {
|
||||
ctx[\`n\`] = v2[i1];
|
||||
ctx[\`n_index\`] = i1;
|
||||
let key1 = ctx['n_index'];
|
||||
c2[i1] = withKey(component(\`Child\`, {val: ctx['n_index']}, key + \`__1__\${key1}\`, node, ctx), key1);
|
||||
}
|
||||
let b2 = list(c2);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user