mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
d6668e3439
We add some test for the t-on directive. For making them pass, it was necessary to change the code produced by compileTForeach: the const declaration is not done by using generateId and there was some conflict with the variable names produced in captureExpression. Consequently, many snapshots had to be changed. Code prettification has been done too.
1032 lines
34 KiB
Plaintext
1032 lines
34 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`t-call (template calling) basic caller 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>ok</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) basic caller 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;
|
|
const callTemplate_2 = getTemplate(\`_basic-callee\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) basic caller, no parent node 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>ok</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) basic caller, no parent node 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;
|
|
const callTemplate_2 = getTemplate(\`_basic-callee\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) call with several sub nodes on same line 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(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = html(ctx[zero]);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) call with several sub nodes on same line 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<span>hey</span>\`);
|
|
let block5 = createBlock(\`<span>yay</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b3 = block3();
|
|
let b4 = text(\` \`);
|
|
let b5 = block5();
|
|
let b2 = multi([b3, b4, b5]);
|
|
ctx[zero] = b2;
|
|
let b6 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b6]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0' 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(\`<div><span>cascade 2</span><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = html(ctx[zero]);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0' 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;
|
|
const callTemplate_2 = getTemplate(\`finalTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<span>cascade 1</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b3 = block3();
|
|
let b4 = html(ctx[zero]);
|
|
let b2 = multi([b3, b4]);
|
|
ctx[zero] = b2;
|
|
let b5 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0' 3`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
const callTemplate_2 = getTemplate(\`subSubTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<span>cascade 0</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b3 = block3();
|
|
let b4 = html(ctx[zero]);
|
|
let b2 = multi([b3, b4]);
|
|
ctx[zero] = b2;
|
|
let b5 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0' 4`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
const callTemplate_2 = getTemplate(\`subTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<span>hey</span>\`);
|
|
let block5 = createBlock(\`<span>yay</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b3 = block3();
|
|
let b4 = text(\` \`);
|
|
let b5 = block5();
|
|
let b2 = multi([b3, b4, b5]);
|
|
ctx[zero] = b2;
|
|
let b6 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b6]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0', without external divs 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 block2 = createBlock(\`<span>cascade 2</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = block2();
|
|
let b3 = html(ctx[zero]);
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0', without external divs 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;
|
|
const callTemplate_2 = getTemplate(\`finalTemplate\`);
|
|
|
|
let block2 = createBlock(\`<span>cascade 1</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b2 = block2();
|
|
let b3 = html(ctx[zero]);
|
|
let b1 = multi([b2, b3]);
|
|
ctx[zero] = b1;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0', without external divs 3`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
const callTemplate_2 = getTemplate(\`subSubTemplate\`);
|
|
|
|
let block2 = createBlock(\`<span>cascade 0</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b2 = block2();
|
|
let b3 = html(ctx[zero]);
|
|
let b1 = multi([b2, b3]);
|
|
ctx[zero] = b1;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) cascading t-call t-raw='0', without external divs 4`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
const callTemplate_2 = getTemplate(\`subTemplate\`);
|
|
|
|
let block2 = createBlock(\`<span>hey</span>\`);
|
|
let block4 = createBlock(\`<span>yay</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b2 = block2();
|
|
let b3 = text(\` \`);
|
|
let b4 = block4();
|
|
let b1 = multi([b2, b3, b4]);
|
|
ctx[zero] = b1;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) dynamic t-call 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(\`<foo><block-text-0/></foo>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['val'];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) dynamic t-call 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(\`<bar><block-text-0/></bar>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['val'];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) dynamic t-call 3`] = `
|
|
"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 = \\"\\") {
|
|
const template2 = (ctx['template']);
|
|
let b2 = call(template2, ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) inherit context 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;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(ctx['foo']);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) inherit context 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[\`foo\`] = 1;
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 1 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;
|
|
const callTemplate_2 = getTemplate(\`recursive\`);
|
|
|
|
let block1 = createBlock(\`<div><span>hey</span><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2;
|
|
if (false) {
|
|
b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 2 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;
|
|
const callTemplate_2 = getTemplate(\`nodeTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`node\`] = ctx['root'];
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 2 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;
|
|
const callTemplate_2 = getTemplate(\`nodeTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let d1 = ctx['node'].val;
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]);
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`subtree\`] = v_block2[i1];
|
|
ctx[\`subtree_first\`] = i1 === 0;
|
|
ctx[\`subtree_last\`] = i1 === v_block2.length - 1;
|
|
ctx[\`subtree_index\`] = i1;
|
|
ctx[\`subtree_value\`] = k_block2[i1];
|
|
let key1 = ctx['subtree_index'];
|
|
ctx = Object.create(ctx);
|
|
ctx[\`node\`] = ctx['subtree'];
|
|
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
let b2 = list(c_block2);
|
|
return block1([d1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 3 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;
|
|
const callTemplate_2 = getTemplate(\`nodeTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`node\`] = ctx['root'];
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 3 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;
|
|
const callTemplate_2 = getTemplate(\`nodeTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let d1 = ctx['node'].val;
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]);
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`subtree\`] = v_block2[i1];
|
|
ctx[\`subtree_first\`] = i1 === 0;
|
|
ctx[\`subtree_last\`] = i1 === v_block2.length - 1;
|
|
ctx[\`subtree_index\`] = i1;
|
|
ctx[\`subtree_value\`] = k_block2[i1];
|
|
let key1 = ctx['subtree_index'];
|
|
ctx = Object.create(ctx);
|
|
ctx[\`node\`] = ctx['subtree'];
|
|
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
let b2 = list(c_block2);
|
|
return block1([d1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 4: with t-set recursive index 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;
|
|
const callTemplate_2 = getTemplate(\`nodeTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`recursive_idx\`] = 1;
|
|
ctx[\`node\`] = ctx['root'];
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) recursive template, part 4: with t-set recursive index 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;
|
|
const callTemplate_2 = getTemplate(\`nodeTemplate\`);
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/> <block-text-1/></p><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[\`recursive_idx\`] = ctx['recursive_idx']+1;
|
|
let d1 = ctx['node'].val;
|
|
let d2 = ctx['recursive_idx'];
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['node'].children||[]);
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`subtree\`] = v_block2[i1];
|
|
ctx[\`subtree_first\`] = i1 === 0;
|
|
ctx[\`subtree_last\`] = i1 === v_block2.length - 1;
|
|
ctx[\`subtree_index\`] = i1;
|
|
ctx[\`subtree_value\`] = k_block2[i1];
|
|
let key1 = ctx['subtree_index'];
|
|
ctx = Object.create(ctx);
|
|
ctx[\`node\`] = ctx['subtree'];
|
|
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
let b2 = list(c_block2);
|
|
return block1([d1, d2], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) scoped parameters 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;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(\`ok\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) scoped parameters 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`foo\`] = 42;
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
ctx = ctx.__proto__;
|
|
let d1 = ctx['foo'];
|
|
return block1([d1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) scoped parameters, part 2 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;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(ctx['foo']);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) scoped parameters, part 2 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[\`foo\`] = 11;
|
|
ctx = Object.create(ctx);
|
|
ctx[\`foo\`] = 42;
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
ctx = ctx.__proto__;
|
|
let d1 = ctx['foo'];
|
|
return block1([d1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call allowed on a non t node 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call allowed on a non t node 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(\`<span>ok</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with body content as root of a template 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(\`<foo><block-child-0/></foo>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = html(ctx[zero]);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with body content as root of a template 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;
|
|
const callTemplate_2 = getTemplate(\`antony\`);
|
|
|
|
let block1 = createBlock(\`<p>antony</p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b1 = block1();
|
|
ctx[zero] = b1;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-if 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2;
|
|
if (ctx['flag']) {
|
|
b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-if 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(\`<span>ok</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and body text content 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`val\`] = \`yip yip\`;
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and body text content 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(\`<p><block-text-0/></p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['val'];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and outside 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`v\`] = v_block2[i1];
|
|
ctx[\`v_first\`] = i1 === 0;
|
|
ctx[\`v_last\`] = i1 === v_block2.length - 1;
|
|
ctx[\`v_index\`] = i1;
|
|
ctx[\`v_value\`] = k_block2[i1];
|
|
let key1 = ctx['v_index'];
|
|
ctx[\`val\`] = ctx['v'].val;
|
|
ctx = Object.create(ctx);
|
|
ctx[\`val3\`] = ctx['val']*3;
|
|
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
let b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and outside 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(\`<span><block-text-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['val3'];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and outside. 2 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`v\`] = v_block2[i1];
|
|
ctx[\`v_first\`] = i1 === 0;
|
|
ctx[\`v_last\`] = i1 === v_block2.length - 1;
|
|
ctx[\`v_index\`] = i1;
|
|
ctx[\`v_value\`] = k_block2[i1];
|
|
let key1 = ctx['v_index'];
|
|
ctx[\`val\`] = ctx['v'].val;
|
|
ctx = Object.create(ctx);
|
|
ctx[\`val3\`] = ctx['val']*3;
|
|
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
let b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and outside. 2 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 block2 = createBlock(\`<span><block-text-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['val3'];
|
|
let b2 = block2([d1]);
|
|
let b3 = text(ctx['w']);
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call with t-set inside and outside. 2 3`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
const callTemplate_2 = getTemplate(\`main\`);
|
|
|
|
let block1 = createBlock(\`<p><block-child-0/></p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[\`w\`] = 'fromwrapper';
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call, conditional and t-set in t-call body 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(\`<div>callee1</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call, conditional and t-set in t-call body 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>callee2 <block-text-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['v'];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-call, conditional and t-set in t-call body 3`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
const callTemplate_2 = getTemplate(\`callee1\`);
|
|
const callTemplate_4 = getTemplate(\`callee2\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b2,b3;
|
|
ctx[\`v1\`] = 'elif';
|
|
if (ctx['v1']==='if') {
|
|
b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
} else if (ctx['v1']==='elif') {
|
|
ctx = Object.create(ctx);
|
|
ctx[\`v\`] = 'success';
|
|
b3 = callTemplate_4(ctx, node, key + \`__3\`);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-esc inside t-call, with t-set outside 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[\`v\`] = \`Hi\`;
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) t-esc inside t-call, with t-set outside 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(\`<span><block-text-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['v'];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with unused body 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(\`<div>ok</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with unused body 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b1 = text(\`WHEEE\`);
|
|
ctx[zero] = b1;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with unused setbody 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(\`<div>ok</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with unused setbody 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`qux\`] = 3;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with used body 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(\`<h1><block-text-0/></h1>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx[zero];
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with used body 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
let b1 = text(\`ok\`);
|
|
ctx[zero] = b1;
|
|
return callTemplate_2(ctx, node, key + \`__1\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with used setbody 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;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(ctx['foo']);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling) with used setbody 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;
|
|
const callTemplate_2 = getTemplate(\`sub\`);
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx = Object.create(ctx);
|
|
ctx[\`foo\`] = 'ok';
|
|
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|