2020-11-26 16:45:25 +01:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
|
|
exports[`list of components components in a node in a t-foreach 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><ul><block-child-0/></ul></div>\`);
|
|
|
|
|
let block3 = createBlock(\`<li><block-child-0/></li>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`item\`] = v_block2[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = 'li_'+ctx['item'];
|
2022-06-22 15:39:31 +02:00
|
|
|
const b4 = comp1({item: ctx['item']}, key + \`__1__\${key1}\`, node, this, null);
|
2021-10-15 13:08:07 +02:00
|
|
|
c_block2[i1] = withKey(block3([], [b4]), key1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components components in a node in a t-foreach 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-22 11:01:17 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-22 11:01:17 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
2021-11-22 11:01:17 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].item;
|
|
|
|
|
return block1([txt1]);
|
2021-11-22 11:01:17 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components crash on duplicate key in dev mode 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-22 11:01:17 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2021-11-22 11:01:17 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList([1,2]);;
|
2021-12-20 11:19:59 +01:00
|
|
|
const keys1 = new Set();
|
2021-11-22 11:01:17 +01:00
|
|
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
|
|
|
|
ctx[\`item\`] = v_block1[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = 'child';
|
2021-12-20 11:19:59 +01:00
|
|
|
if (keys1.has(key1)) { throw new Error(\`Got duplicate key in t-foreach: \${key1}\`)}
|
|
|
|
|
keys1.add(key1);
|
2022-01-24 13:25:00 +01:00
|
|
|
const props1 = {};
|
|
|
|
|
helpers.validateProps(\`Child\`, props1, ctx);
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block1[i1] = withKey(comp1(props1, key + \`__1__\${key1}\`, node, this, null), key1);
|
2021-11-22 11:01:17 +01:00
|
|
|
}
|
|
|
|
|
return list(c_block1);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components crash on duplicate key in dev mode 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-15 13:50:55 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-15 13:50:55 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
return text(\`\`);
|
2021-10-15 13:50:55 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components list of sub components inside other nodes 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-15 13:50:55 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`SubComponent\`, true, false, false, true);
|
2021-10-15 13:50:55 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
let block3 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`blip\`] = v_block2[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['blip'].id;
|
2022-06-22 15:39:31 +02:00
|
|
|
const b4 = comp1({}, key + \`__1__\${key1}\`, node, this, null);
|
2021-10-15 13:08:07 +02:00
|
|
|
c_block2[i1] = withKey(block3([], [b4]), key1);
|
2021-10-15 13:50:55 +02:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2021-10-15 13:50:55 +02:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components list of sub components inside other nodes 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<span>asdf</span>\`);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
return block1();
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components reconciliation alg works for t-foreach in t-foreach 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].s);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`section\`] = v_block2[i1];
|
2020-11-26 16:45:25 +01:00
|
|
|
ctx[\`section_index\`] = i1;
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['section_index'];
|
2020-11-26 16:45:25 +01:00
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['section'].blips);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i2 = 0; i2 < l_block3; i2++) {
|
|
|
|
|
ctx[\`blip\`] = v_block3[i2];
|
2020-11-26 16:45:25 +01:00
|
|
|
ctx[\`blip_index\`] = i2;
|
2022-03-06 10:27:07 +01:00
|
|
|
const key2 = ctx['blip_index'];
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block3[i2] = withKey(comp1({blip: ctx['blip']}, key + \`__1__\${key1}__\${key2}\`, node, this, null), key2);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
ctx = ctx.__proto__;
|
2021-10-15 13:08:07 +02:00
|
|
|
c_block2[i1] = withKey(list(c_block3), key1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components reconciliation alg works for t-foreach in t-foreach 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].blip;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components reconciliation alg works for t-foreach in t-foreach, 2 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
let block3 = createBlock(\`<p><block-child-0/></p>\`);
|
|
|
|
|
let block5 = createBlock(\`<p><block-child-0/></p>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].rows);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`row\`] = v_block2[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['row'];
|
2020-11-26 16:45:25 +01:00
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].cols);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i2 = 0; i2 < l_block4; i2++) {
|
|
|
|
|
ctx[\`col\`] = v_block4[i2];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key2 = ctx['col'];
|
2022-06-22 15:39:31 +02:00
|
|
|
const b6 = comp1({row: ctx['row'],col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, this, null);
|
2021-10-15 13:08:07 +02:00
|
|
|
c_block4[i2] = withKey(block5([], [b6]), key2);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
ctx = ctx.__proto__;
|
2022-03-06 10:27:07 +01:00
|
|
|
const b4 = list(c_block4);
|
2021-10-15 13:08:07 +02:00
|
|
|
c_block2[i1] = withKey(block3([], [b4]), key1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components reconciliation alg works for t-foreach in t-foreach, 2 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].row+'_'+ctx['props'].col;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components simple list 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state'].elems);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
|
|
|
|
ctx[\`elem\`] = v_block1[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['elem'].id;
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block1[i1] = withKey(comp1({value: ctx['elem'].value}, key + \`__1__\${key1}\`, node, this, null), key1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
2021-10-15 13:08:07 +02:00
|
|
|
return list(c_block1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components simple list 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].value;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components sub components rendered in a loop 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`number\`] = v_block2[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['number'];
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block2[i1] = withKey(comp1({n: ctx['number']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components sub components rendered in a loop 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<p><block-text-0/></p>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].n;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components sub components with some state rendered in a loop 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2020-11-26 16:45:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers);;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`number\`] = v_block2[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['number'];
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block2[i1] = withKey(comp1({}, key + \`__1__\${key1}\`, node, this, null), key1);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
2021-10-15 13:07:53 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components sub components with some state rendered in a loop 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-04 13:46:49 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-04 13:46:49 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<p><block-text-0/></p>\`);
|
2021-11-04 13:46:49 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['state'].n;
|
|
|
|
|
return block1([txt1]);
|
2021-11-04 13:46:49 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components switch component position 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-04 13:46:49 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2021-11-04 13:46:49 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['clist']);;
|
2021-11-04 13:46:49 +01:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`c\`] = v_block2[i1];
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['c'];
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block2[i1] = withKey(comp1({key: ctx['c']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
2021-11-04 13:46:49 +01:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2021-11-04 13:46:49 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components switch component position 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-15 13:07:53 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-15 13:07:53 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
2021-10-15 13:07:53 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].key;
|
|
|
|
|
return block1([txt1]);
|
2021-10-15 13:07:53 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`list of components t-foreach with t-component, and update 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-15 13:07:53 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-01 17:03:53 +01:00
|
|
|
let { prepareList, withKey } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2021-10-15 13:07:53 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
2022-03-06 10:27:07 +01:00
|
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));;
|
2021-10-15 13:08:07 +02:00
|
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
|
|
|
ctx[\`n\`] = v_block2[i1];
|
2021-10-15 13:07:53 +02:00
|
|
|
ctx[\`n_index\`] = i1;
|
2022-03-06 10:27:07 +01:00
|
|
|
const key1 = ctx['n_index'];
|
2022-06-22 15:39:31 +02:00
|
|
|
c_block2[i1] = withKey(comp1({val: ctx['n_index']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
2021-10-15 13:07:53 +02:00
|
|
|
}
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = list(c_block2);
|
2021-10-15 13:07:53 +02:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
2021-12-20 11:19:59 +01:00
|
|
|
|
|
|
|
|
exports[`list of components t-foreach with t-component, and update 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-20 11:19:59 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-20 11:19:59 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['state'].val;
|
|
|
|
|
let txt2 = ctx['props'].val;
|
|
|
|
|
return block1([txt1, txt2]);
|
2021-12-20 11:19:59 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|