Files
owl/tests/components/__snapshots__/higher_order_component.test.ts.snap
T

187 lines
5.1 KiB
Plaintext
Raw Normal View History

2020-11-26 16:45:25 +01:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`basics basic use 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
2020-11-26 16:45:25 +01:00
2021-12-20 11:19:59 +01:00
return function template(ctx, node, key = \\"\\") {
return comp1({p: 1}, key + \`__1\`, node, this, null);
2021-12-20 11:19:59 +01:00
}
}"
`;
exports[`basics basic use 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-12-20 11:19:59 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-12-20 11:19:59 +01:00
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span>child<block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['props'].p;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics can select a sub widget 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
const comp2 = app.createComponent(\`OtherChild\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
2021-12-20 11:19:59 +01:00
let b2,b3;
if (ctx['env'].options.flag) {
b2 = comp1({}, key + \`__1\`, node, this, null);
2021-12-20 11:19:59 +01:00
}
if (!ctx['env'].options.flag) {
b3 = comp2({}, key + \`__2\`, node, this, null);
2021-12-20 11:19:59 +01:00
}
return multi([b2, b3]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics can select a sub widget 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span>CHILD 1</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics can select a sub widget 3`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div>CHILD 2</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics can select a sub widget, part 2 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
const comp2 = app.createComponent(\`OtherChild\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
let b2,b3;
2021-12-20 11:19:59 +01:00
if (ctx['state'].flag) {
b2 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
2021-12-20 11:19:59 +01:00
if (!ctx['state'].flag) {
b3 = comp2({}, key + \`__2\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
return multi([b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics can select a sub widget, part 2 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span>CHILD 1</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics can select a sub widget, part 2 3`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div>CHILD 2</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics sub widget is interactive 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return comp1({p: 1}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics sub widget is interactive 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><button block-handler-0=\\"click\\">click</button>child<block-text-1/></span>\`);
return function template(ctx, node, key = \\"\\") {
let hdlr1 = [ctx['inc'], ctx];
let txt1 = ctx['state'].val;
return block1([hdlr1, txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics top level sub widget with a parent 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`ComponentB\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
const b2 = comp1({}, key + \`__1\`, node, this, null);
2021-12-20 11:19:59 +01:00
return block1([], [b2]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics top level sub widget with a parent 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`ComponentC\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics top level sub widget with a parent 3`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2020-11-26 16:45:25 +01: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>Hello</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
}
}"
`;