2020-11-26 16:45:25 +01:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks basic checks for a component 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>test</span>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-10-21 10:13:08 +02:00
|
|
|
exports[`lifecycle hooks component semantics 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`B\`, true, false, false, true);
|
|
|
|
|
const comp2 = app.createComponent(\`C\`, true, false, false, true);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>A<block-child-0/><block-child-1/></div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
|
|
|
|
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
return block1([], [b2, b3]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks component semantics 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>B</div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks component semantics 3`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`D\`, true, false, false, true);
|
|
|
|
|
const comp2 = app.createComponent(\`E\`, true, false, false, true);
|
|
|
|
|
const comp3 = app.createComponent(\`F\`, true, false, false, true);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>C<block-child-0/><block-child-1/><block-child-2/></div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
let b2,b3,b4;
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
if (ctx['state'].flag) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b3 = comp2({}, key + \`__2\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
} else {
|
2022-06-22 15:39:31 +02:00
|
|
|
b4 = comp3({}, key + \`__3\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
}
|
|
|
|
|
return block1([], [b2, b3, b4]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks component semantics 4`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>D</div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks component semantics 5`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>E</div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
return block1();
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks component semantics 6`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>F</div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
return block1();
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-11-29 14:06:53 +01:00
|
|
|
exports[`lifecycle hooks components are unmounted and destroyed if no longer in DOM, even after updateprops 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-11-29 14:06:53 +01:00
|
|
|
let block2 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
2020-11-26 16:45:25 +01:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
2021-11-29 14:06:53 +01:00
|
|
|
if (ctx['state'].flag) {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b3 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
2021-11-29 14:06:53 +01:00
|
|
|
b2 = block2([], [b3]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks components are unmounted and destroyed if no longer in DOM, even after updateprops 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;
|
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['props'].n;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks components are unmounted destroyed if no longer in DOM 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
2021-11-29 14:06:53 +01:00
|
|
|
if (ctx['state'].ok) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks components are unmounted destroyed if no longer in DOM 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-27 14:55:02 +01:00
|
|
|
exports[`lifecycle hooks destroy new children before being mountged 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-27 14:55:02 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2022-01-27 14:55:02 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2,b3,b4;
|
|
|
|
|
b2 = text(\`before\`);
|
|
|
|
|
if (ctx['state'].flag) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b3 = comp1({}, key + \`__1\`, node, this, null);
|
2022-01-27 14:55:02 +01:00
|
|
|
}
|
|
|
|
|
b4 = text(\`after\`);
|
|
|
|
|
return multi([b2, b3, b4]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks destroy new children before being mountged 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-27 14:55:02 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-27 14:55:02 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return text(\`child\`);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks hooks are called in proper order in widget creation/destruction 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks hooks are called in proper order in widget creation/destruction 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-18 14:54:58 +01:00
|
|
|
exports[`lifecycle hooks lifecycle callbacks are bound to component 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-18 14:54:58 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Test\`, true, false, false, false);
|
2022-01-18 14:54:58 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({rev: ctx['rev']}, key + \`__1\`, node, this, null);
|
2022-01-18 14:54:58 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks lifecycle callbacks are bound to component 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-18 14:54:58 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-18 14:54:58 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return text(ctx['props'].rev);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 2 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].hasChild) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 2 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;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 2 3`] = `
|
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
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 3 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].hasChild) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 4 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, 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;
|
|
|
|
|
if (ctx['state'].hasChild) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 4 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;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 4 3`] = `
|
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/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 5 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].hasChild) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 5 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 6 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks lifecycle semantics, part 6 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called if mounted in DOM 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-22 09:53:36 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-22 09:53:36 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
2021-10-22 09:53:36 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on every mount, not just the first one 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-22 09:53:36 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2021-10-22 09:53:36 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].hasChild) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-10-22 09:53:36 +02:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on every mount, not just the first one 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div>child</div>\`);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on subcomponents, in proper order 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on subcomponents, in proper order 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper order 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].flag) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
}
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper order 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;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper order 3`] = `
|
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
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
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
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks onWillRender 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({someValue: ctx['state'].value}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks onWillRender 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-text-1/></button>\`);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let hdlr1 = [ctx['increment'], ctx];
|
2021-12-22 12:33:17 +01:00
|
|
|
let txt1 = ctx['state'].value;
|
|
|
|
|
return block1([hdlr1, txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks patched hook is called after updateProps 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
exports[`lifecycle hooks patched hook is called after updateProps 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-20 11:19:59 +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 block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2020-11-26 16:45:25 +01:00
|
|
|
exports[`lifecycle hooks patched hook is called after updating State 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
|
|
|
|
2021-10-26 14:51:57 +02:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
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['state'].a;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-14 09:31:25 +01:00
|
|
|
exports[`lifecycle hooks render in mounted 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-14 09:31:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-14 09:31: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['patched'];
|
|
|
|
|
return block1([txt1]);
|
2021-12-14 09:31:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks render in patched 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-14 09:31:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-14 09:31: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['patched'];
|
|
|
|
|
return block1([txt1]);
|
2021-12-14 09:31:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks render in willPatch 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-14 09:31:25 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-14 09:31: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['patched'];
|
|
|
|
|
return block1([txt1]);
|
2021-12-14 09:31:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-10-15 13:50:55 +02:00
|
|
|
exports[`lifecycle hooks sub widget (inside sub node): hooks are correctly called 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-15 13:50:55 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2021-10-15 13:50:55 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].flag) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
2021-10-15 13:50:55 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks sub widget (inside sub node): hooks are correctly called 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-15 13:50:55 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-15 13:50:55 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
2021-10-15 13:50:55 +02:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
return block1();
|
2021-10-15 13:50:55 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-03-14 09:37:21 +01:00
|
|
|
exports[`lifecycle hooks timeout in onWillStart emits a warning 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-03-14 09:37:21 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-03-14 09:37:21 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<span/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks timeout in onWillUpdateProps emits a warning 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-03-14 09:37:21 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2022-03-14 09:37:21 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const props1 = {prop: ctx['state'].prop};
|
|
|
|
|
helpers.validateProps(\`Child\`, props1, ctx);
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1(props1, key + \`__1\`, node, this, null);
|
2022-03-14 09:37:21 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks timeout in onWillUpdateProps emits a warning 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-03-14 09:37:21 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-03-14 09:37:21 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return text(\`\`);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2020-11-26 16:45:25 +01:00
|
|
|
exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, in proper order 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-06-09 14:55:57 +02:00
|
|
|
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
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({n: ctx['state'].n}, 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[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, in proper order 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;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
const b2 = comp1({n: ctx['props'].n}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
return block1([], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, in proper order 3`] = `
|
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
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
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['props'].n;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willStart hook is called on sub component 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willStart hook is called on sub component 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willStart is called 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>simple vnode</span>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willStart is called with component as this 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>simple vnode</span>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willStart, mounted on subwidget rendered after main is mounted in some other position 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, 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/><block-child-1/></div>\`);
|
|
|
|
|
let block3 = createBlock(\`<div/>\`);
|
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['state'].ok) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
} else {
|
|
|
|
|
b3 = block3();
|
|
|
|
|
}
|
|
|
|
|
return block1([], [b2, b3]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willStart, mounted on subwidget rendered after main is mounted in some other position 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;
|
2020-11-26 16:45:25 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
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
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willUpdateProps hook is called 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-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
2020-11-26 16:45:25 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`lifecycle hooks willUpdateProps hook is called 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;
|
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['props'].n;
|
|
|
|
|
return block1([txt1]);
|
2020-11-26 16:45:25 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|