[REF] tests: improve test helpers

- remove snapshotApp
- remove addTemplates
- simplify helpers
- make sure snapshotted templates are snapshotted with the app config
This commit is contained in:
Géry Debongnie
2021-12-20 11:19:59 +01:00
committed by Aaron Bohy
parent ddc358f48a
commit 7eaecac0b5
48 changed files with 4157 additions and 3279 deletions
@@ -2,20 +2,6 @@
exports[`list of components components in a node in a t-foreach 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].item;
return block1([d1]);
}
}"
`;
exports[`list of components components in a node in a t-foreach 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { prepareList, withKey } = helpers;
@@ -38,6 +24,20 @@ exports[`list of components components in a node in a t-foreach 2`] = `
}"
`;
exports[`list of components components in a node in a t-foreach 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].item;
return block1([d1]);
}
}"
`;
exports[`list of components crash on duplicate key in dev mode 1`] = `
"function anonymous(bdom, helpers
) {
@@ -73,40 +73,8 @@ exports[`list of components crash on duplicate key in dev mode 2`] = `
}"
`;
exports[`list of components crash on duplicate key in dev mode 3`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { prepareList, withKey } = helpers;
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
const [k_block1, v_block1, l_block1, c_block1] = prepareList([1,2]);
for (let i1 = 0; i1 < l_block1; i1++) {
ctx[\`item\`] = v_block1[i1];
let key1 = 'child';
c_block1[i1] = withKey(component(\`Child\`, {}, key + \`__1__\${key1}\`, node, ctx), key1);
}
return list(c_block1);
}
}"
`;
exports[`list of components list of sub components inside other nodes 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<span>asdf</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`list of components list of sub components inside other nodes 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { prepareList, withKey } = helpers;
@@ -129,21 +97,20 @@ exports[`list of components list of sub components inside other nodes 2`] = `
}"
`;
exports[`list of components reconciliation alg works for t-foreach in t-foreach 1`] = `
exports[`list of components list of sub components inside other nodes 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div><block-text-0/></div>\`);
let block1 = createBlock(\`<span>asdf</span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].blip;
return block1([d1]);
return block1();
}
}"
`;
exports[`list of components reconciliation alg works for t-foreach in t-foreach 2`] = `
exports[`list of components reconciliation alg works for t-foreach in t-foreach 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -175,7 +142,7 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach
}"
`;
exports[`list of components reconciliation alg works for t-foreach in t-foreach, 2 1`] = `
exports[`list of components reconciliation alg works for t-foreach in t-foreach 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -183,13 +150,13 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach,
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].row+'_'+ctx['props'].col;
let d1 = ctx['props'].blip;
return block1([d1]);
}
}"
`;
exports[`list of components reconciliation alg works for t-foreach in t-foreach, 2 2`] = `
exports[`list of components reconciliation alg works for t-foreach in t-foreach, 2 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -223,21 +190,21 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach,
}"
`;
exports[`list of components simple list 1`] = `
exports[`list of components reconciliation alg works for t-foreach in t-foreach, 2 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<span><block-text-0/></span>\`);
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].value;
let d1 = ctx['props'].row+'_'+ctx['props'].col;
return block1([d1]);
}
}"
`;
exports[`list of components simple list 2`] = `
exports[`list of components simple list 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -256,21 +223,21 @@ exports[`list of components simple list 2`] = `
}"
`;
exports[`list of components sub components rendered in a loop 1`] = `
exports[`list of components simple list 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<p><block-text-0/></p>\`);
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].n;
let d1 = ctx['props'].value;
return block1([d1]);
}
}"
`;
exports[`list of components sub components rendered in a loop 2`] = `
exports[`list of components sub components rendered in a loop 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -292,7 +259,7 @@ exports[`list of components sub components rendered in a loop 2`] = `
}"
`;
exports[`list of components sub components with some state rendered in a loop 1`] = `
exports[`list of components sub components rendered in a loop 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -300,13 +267,13 @@ exports[`list of components sub components with some state rendered in a loop 1`
let block1 = createBlock(\`<p><block-text-0/></p>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].n;
let d1 = ctx['props'].n;
return block1([d1]);
}
}"
`;
exports[`list of components sub components with some state rendered in a loop 2`] = `
exports[`list of components sub components with some state rendered in a loop 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -328,21 +295,21 @@ exports[`list of components sub components with some state rendered in a loop 2`
}"
`;
exports[`list of components switch component position 1`] = `
exports[`list of components sub components with some state rendered in a loop 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<div><block-text-0/></div>\`);
let block1 = createBlock(\`<p><block-text-0/></p>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['props'].key;
let d1 = ctx['state'].n;
return block1([d1]);
}
}"
`;
exports[`list of components switch component position 2`] = `
exports[`list of components switch component position 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -364,22 +331,21 @@ exports[`list of components switch component position 2`] = `
}"
`;
exports[`list of components t-foreach with t-component, and update 1`] = `
exports[`list of components switch component position 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].val;
let d2 = ctx['props'].val;
return block1([d1, d2]);
let d1 = ctx['props'].key;
return block1([d1]);
}
}"
`;
exports[`list of components t-foreach with t-component, and update 2`] = `
exports[`list of components t-foreach with t-component, and update 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
@@ -401,3 +367,18 @@ exports[`list of components t-foreach with t-component, and update 2`] = `
}
}"
`;
exports[`list of components t-foreach with t-component, and update 2`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].val;
let d2 = ctx['props'].val;
return block1([d1, d2]);
}
}"
`;