mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
11e4e67599
Previously, there were a few places where the compiler would create strings from template content and emit them as template literals, but didn't properly escape characters or character sequences with special meanings, in particular: backslashes, backticks, and interpolation sigils. This commit fixes this in: - block creation (interpolation sigils were not escaped) - text node creation (no escaping was performed) - comment not creation (no escaping was performed) - default values for t-esc (no escaping was performed) - body of a t-set (no escaping was performed)
80 lines
2.0 KiB
Plaintext
80 lines
2.0 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`comments comment node with backslash at top level 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comment(\` \\\\\\\\ \`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`comments comment node with backtick at top-level 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comment(\` \\\\\` \`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`comments comment node with interpolation sigil at top level 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comment(\` \\\\\${very cool} \`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`comments only a comment 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comment(\` comment\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`comments properly handle comments 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div>hello <!-- comment-->owl</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`comments properly handle comments between t-if/t-else 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
|
let block2 = createBlock(\`<span>true</span>\`);
|
|
let block3 = createBlock(\`<span>owl</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2, b3;
|
|
if (true) {
|
|
b2 = block2();
|
|
} else {
|
|
b3 = block3();
|
|
}
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|