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

143 lines
4.3 KiB
Plaintext
Raw Normal View History

2021-10-25 12:45:43 +02:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`reactivity in lifecycle Child component doesn't render when state they depend on changes but their parent is about to unmount them 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].renderChild) {
b2 = comp1({state: ctx['state']}, key + \`__1\`, node, this, null);
}
return multi([b2]);
}
}"
`;
exports[`reactivity in lifecycle Child component doesn't render when state they depend on changes but their parent is about to unmount them 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
return text(ctx['props'].state.content.a);
}
}"
`;
exports[`reactivity in lifecycle Component is automatically subscribed to reactive object received as prop 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
return comp1({obj: ctx['obj'],reactiveObj: ctx['reactiveObj']}, key + \`__1\`, node, this, null);
}
}"
`;
exports[`reactivity in lifecycle Component is automatically subscribed to reactive object received as prop 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
return function template(ctx, node, key = \\"\\") {
const b2 = text(ctx['props'].obj.a);
const b3 = text(ctx['props'].reactiveObj.b);
return multi([b2, b3]);
}
}"
`;
2021-10-25 12:45:43 +02:00
exports[`reactivity in lifecycle can use a state hook 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-25 12:45:43 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-10-25 12:45:43 +02:00
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['counter'].value;
return block1([txt1]);
2021-10-25 12:45:43 +02:00
}
}"
`;
exports[`reactivity in lifecycle can use a state hook 2 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].a;
return block1([txt1]);
}
}"
`;
exports[`reactivity in lifecycle can use a state hook on Map 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['counter'].get('value');
return block1([txt1]);
}
}"
`;
2021-10-25 12:45:43 +02:00
exports[`reactivity in lifecycle change state while mounting component 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-25 12:45:43 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-10-25 12:45:43 +02:00
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].val;
return block1([txt1]);
2021-10-25 12:45:43 +02:00
}
}"
`;
exports[`reactivity in lifecycle state changes in willUnmount do not trigger rerender 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-25 12:45:43 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
2021-10-25 12:45:43 +02:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
2021-10-25 12:45:43 +02:00
return function template(ctx, node, key = \\"\\") {
2021-12-20 11:19:59 +01:00
let b2;
if (ctx['state'].flag) {
b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
2021-12-20 11:19:59 +01:00
}
return block1([], [b2]);
2021-10-25 12:45:43 +02:00
}
}"
`;
exports[`reactivity in lifecycle state changes in willUnmount do not trigger rerender 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-25 12:45:43 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-10-25 12:45:43 +02:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
2021-10-25 12:45:43 +02:00
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['props'].val;
let txt2 = ctx['state'].n;
return block1([txt1, txt2]);
2021-10-25 12:45:43 +02:00
}
}"
`;