2020-11-26 16:45:25 +01:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
2024-05-08 13:02:26 +02:00
exports[`t-esc default with backslash at top level 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { withDefault } = helpers;
return function template(ctx, node, key = \\"\\") {
return text(withDefault(undefined, \`\\\\\\\\\`));
}
}"
`;
exports[`t-esc default with backtick at top-level 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { withDefault } = helpers;
return function template(ctx, node, key = \\"\\") {
return text(withDefault(undefined, \`\\\\\`\`));
}
}"
`;
exports[`t-esc default with interpolation sigil at top level 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { withDefault } = helpers;
return function template(ctx, node, key = \\"\\") {
return text(withDefault(undefined, \`\\\\\${very cool}\`));
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`t-esc div with falsy values 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><p><block-text-0/></p><p><block-text-1/></p><p><block-text-2/></p><p><block-text-3/></p><p><block-text-4/></p></div>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = ctx['v1'];
let txt2 = ctx['v2'];
let txt3 = ctx['v3'];
let txt4 = ctx['v4'];
let txt5 = ctx['v5'];
return block1([txt1, txt2, txt3, txt4, txt5]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc escaping 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = ctx['var'];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc escaping on a node 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = 'ok';
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc escaping on a node with a body 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 { withDefault } = helpers;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = withDefault('ok', \`nope\`);
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc escaping on a node with a body, as a default 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 { withDefault } = helpers;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = withDefault(ctx['var'], \`nope\`);
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc falsy values in text nodes 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;
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
2022-03-06 10:27:07 +01:00
const b2 = text(ctx['v1']);
const b3 = text(\`:\`);
const b4 = text(ctx['v2']);
const b5 = text(\`:\`);
const b6 = text(ctx['v3']);
const b7 = text(\`:\`);
const b8 = text(ctx['v4']);
const b9 = text(\`:\`);
const b10 = text(ctx['v5']);
2020-11-26 16:45:25 +01:00
return multi([b2, b3, b4, b5, b6, b7, b8, b9, b10]);
}
}"
`;
exports[`t-esc literal 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = 'ok';
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc t-esc is escaped 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-22 15:06:28 +01:00
let { isBoundary, withDefault, LazyValue } = helpers;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-text-0/></div>\`);
let block2 = createBlock(\`<p>escaped</p>\`);
2021-12-22 15:06:28 +01:00
function value1(ctx, node, key = \\"\\") {
return block2();
}
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
2021-10-19 11:00:26 +02:00
ctx[isBoundary] = 1
2022-09-28 09:34:30 +02:00
ctx[\`var\`] = new LazyValue(value1, ctx, this, node, key);
2021-12-22 11:33:12 +01:00
let txt1 = ctx['var'];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2022-06-28 13:21:01 +02:00
exports[`t-esc t-esc with the 0 number 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return text(ctx['var']);
}
}"
`;
exports[`t-esc t-esc with the 0 number, in a p 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<p><block-text-0/></p>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['var'];
return block1([txt1]);
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`t-esc t-esc work with spread operator 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = [...ctx['state'].list];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc t-esc=0 is escaped 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;
2022-05-26 15:09:09 +02:00
let { isBoundary, zero } = helpers;
const callTemplate_1 = app.getTemplate(\`sub\`);
2020-11-26 16:45:25 +01:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
2023-08-04 08:52:53 +02:00
let block3 = createBlock(\`<p>escaped</p>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
2021-12-20 11:19:59 +01:00
ctx = Object.create(ctx);
ctx[isBoundary] = 1;
2023-08-04 08:52:53 +02:00
const b3 = block3();
ctx[zero] = b3;
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
return block1([], [b2]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`t-esc t-esc=0 is escaped 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;
2021-12-20 11:19:59 +01:00
let { zero } = helpers;
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[zero];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2022-06-28 13:21:01 +02:00
exports[`t-esc top level t-esc with undefined 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return text(ctx['var']);
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`t-esc variable 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-22 11:33:12 +01:00
let txt1 = ctx['var'];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;