2021-10-19 11:00:26 +02:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
|
|
exports[`t-set slot setted value (with t-set) not accessible with t-esc 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-10 14:35:57 +01:00
|
|
|
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Childcomp\`, true, true, false, true);
|
2021-10-19 11:00:26 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
2021-12-22 12:33:17 +01:00
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 'inCall');
|
|
|
|
|
return text('');
|
|
|
|
|
}
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2021-12-20 11:19:59 +01:00
|
|
|
setContextValue(ctx, \\"iter\\", 'source');
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
2021-12-20 11:19:59 +01:00
|
|
|
const ctx1 = capture(ctx);
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt2 = ctx['iter'];
|
|
|
|
|
return block1([txt1, txt2], [b2]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slot setted value (with t-set) not accessible with t-esc 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +02: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 { isBoundary, withDefault, setContextValue } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
2021-12-20 11:19:59 +01:00
|
|
|
setContextValue(ctx, \\"iter\\", 'called');
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt2 = ctx['iter'];
|
|
|
|
|
return block1([txt1, txt2]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-22 15:06:28 +01:00
|
|
|
exports[`t-set slots with a t-set with a component in body 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-10 14:35:57 +01:00
|
|
|
let { capture, isBoundary, withDefault, LazyValue, safeOutput, markRaw } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`C\`, true, false, false, true);
|
|
|
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2022-06-22 15:39:31 +02:00
|
|
|
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
|
2022-03-06 10:27:07 +01:00
|
|
|
const b3 = text(\` in slot \`);
|
|
|
|
|
const b4 = safeOutput(ctx['v']);
|
2021-12-22 15:06:28 +01:00
|
|
|
return multi([b3, b4]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function value1(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2021-12-22 15:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const ctx1 = capture(ctx);
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
2021-12-22 15:06:28 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with a t-set with a component in body 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
let { callSlot } = helpers;
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = text(\`Child \`);
|
2022-06-06 08:17:51 +02:00
|
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
2021-12-22 15:06:28 +01:00
|
|
|
return multi([b2, b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with a t-set with a component in body 3`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return text(\`C\`);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with an t-set with a component in body 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-10 14:35:57 +01:00
|
|
|
let { capture, isBoundary, withDefault, LazyValue, safeOutput, markRaw } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
|
|
|
|
const comp2 = app.createComponent(\`Blorg\`, true, true, false, true);
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
let block4 = createBlock(\`<div>coffee</div>\`);
|
|
|
|
|
|
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2022-06-22 15:39:31 +02:00
|
|
|
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
|
2022-03-06 10:27:07 +01:00
|
|
|
const b5 = text(\` tea \`);
|
|
|
|
|
const b6 = safeOutput(ctx['v']);
|
2021-12-22 15:06:28 +01:00
|
|
|
return multi([b5, b6]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function value1(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
2022-03-06 10:27:07 +01:00
|
|
|
const b4 = block4();
|
2021-12-22 15:06:28 +01:00
|
|
|
return multi([b3, b4]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const ctx1 = capture(ctx);
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
2021-12-22 15:06:28 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with an t-set with a component in body 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
let { callSlot } = helpers;
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = text(\`Blorg \`);
|
2022-06-06 08:17:51 +02:00
|
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
2021-12-22 15:06:28 +01:00
|
|
|
return multi([b2, b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with an t-set with a component in body 3`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return text(\`Child\`);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with an unused t-set with a component in body 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-10 14:35:57 +01:00
|
|
|
let { capture, isBoundary, withDefault, LazyValue, markRaw } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
|
|
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2022-06-22 15:39:31 +02:00
|
|
|
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
|
2021-12-22 15:06:28 +01:00
|
|
|
return text(\` in slot \`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function value1(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2021-12-22 15:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const ctx1 = capture(ctx);
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
2021-12-22 15:06:28 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slots with an unused t-set with a component in body 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
let { callSlot } = helpers;
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = text(\`Child \`);
|
2022-06-06 08:17:51 +02:00
|
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
2021-12-22 15:06:28 +01:00
|
|
|
return multi([b2, b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-10-19 11:00:26 +02:00
|
|
|
exports[`t-set t-set can't alter component even if key in component 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +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 { isBoundary, withDefault, setContextValue } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
2021-10-19 11:00:26 +02:00
|
|
|
setContextValue(ctx, \\"iter\\", 5);
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt2 = ctx['iter'];
|
|
|
|
|
return block1([txt1, txt2]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set can't alter component if key not in component 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +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 { isBoundary, withDefault, setContextValue } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
2021-10-19 11:00:26 +02:00
|
|
|
setContextValue(ctx, \\"iter\\", 5);
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt2 = ctx['iter'];
|
|
|
|
|
return block1([txt1, txt2]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set in t-if 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +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 { isBoundary, withDefault, setContextValue } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-0/><block-child-0/><p><block-text-0/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"flag\\", ctx['state'].flag);
|
|
|
|
|
if (ctx['flag']==='if') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 2);
|
|
|
|
|
} else if (ctx['flag']==='elif') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 3);
|
|
|
|
|
} else {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 4);
|
|
|
|
|
}
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
|
|
|
|
return block1([txt1]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set not altered by child comp 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +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 { isBoundary, withDefault, setContextValue } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Childcomp\`, true, false, false, true);
|
2021-10-19 11:00:26 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2021-12-20 11:19:59 +01:00
|
|
|
setContextValue(ctx, \\"iter\\", 'source');
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt2 = ctx['iter'];
|
|
|
|
|
return block1([txt1, txt2], [b2]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set not altered by child comp 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +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 { isBoundary, withDefault, setContextValue } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
2021-12-20 11:19:59 +01:00
|
|
|
setContextValue(ctx, \\"iter\\", 'called');
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt2 = ctx['iter'];
|
|
|
|
|
return block1([txt1, txt2]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set outside modified in t-if 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-19 11:00:26 +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 { isBoundary, withDefault, setContextValue } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-0/><block-child-0/><p><block-text-0/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 0);
|
|
|
|
|
setContextValue(ctx, \\"flag\\", ctx['state'].flag);
|
|
|
|
|
if (ctx['flag']==='if') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 2);
|
|
|
|
|
} else if (ctx['flag']==='elif') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 3);
|
|
|
|
|
} else {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 4);
|
|
|
|
|
}
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['iter'];
|
|
|
|
|
return block1([txt1]);
|
2021-10-19 11:00:26 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
exports[`t-set t-set with a component in body 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><div><block-child-0/></div></div>\`);
|
|
|
|
|
|
|
|
|
|
function value1(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2021-12-22 15:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2022-06-22 15:39:31 +02:00
|
|
|
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
|
2022-03-06 10:27:07 +01:00
|
|
|
const b3 = safeOutput(ctx['v']);
|
2021-12-22 15:06:28 +01:00
|
|
|
return block1([], [b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set with a component in body 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return text(\`Child\`);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set with something in body 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-22 15:06:28 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-22 15:06:28 +01:00
|
|
|
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
|
|
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><div><block-child-0/></div></div>\`);
|
|
|
|
|
let block2 = createBlock(\`<p>coucou</p>\`);
|
|
|
|
|
|
|
|
|
|
function value1(ctx, node, key = \\"\\") {
|
|
|
|
|
return block2();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
2022-06-22 15:39:31 +02:00
|
|
|
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
|
2022-03-06 10:27:07 +01:00
|
|
|
const b3 = safeOutput(ctx['v']);
|
2021-12-22 15:06:28 +01:00
|
|
|
return block1([], [b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|