2021-10-19 11:00:26 +02:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
|
|
exports[`t-set slot setted value (with t-set) not accessible with t-esc 1`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 'called');
|
|
|
|
|
let d2 = ctx['iter'];
|
|
|
|
|
return block1([d1, d2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set slot setted value (with t-set) not accessible with t-esc 2`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
2021-11-19 13:43:21 +01:00
|
|
|
const slot2 = (ctx, node, key) => {
|
2021-10-19 11:00:26 +02:00
|
|
|
setContextValue(ctx, \\"iter\\", 'inCall');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 'source');
|
|
|
|
|
let d1 = ctx['iter'];
|
2021-11-19 13:43:21 +01:00
|
|
|
const ctx1 = capture(ctx);
|
|
|
|
|
let b2 = component(\`Childcomp\`, {slots: {'default': {__render: slot2, __ctx: ctx1}}}, key + \`__3\`, node, ctx);
|
2021-10-19 11:00:26 +02:00
|
|
|
let d2 = ctx['iter'];
|
|
|
|
|
return block1([d1, d2], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set can't alter component even if key in component 1`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 5);
|
|
|
|
|
let d2 = ctx['iter'];
|
|
|
|
|
return block1([d1, d2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set can't alter component if key not in component 1`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 5);
|
|
|
|
|
let d2 = ctx['iter'];
|
|
|
|
|
return block1([d1, d2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set in t-if 1`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-0/><block-child-0/><p><block-text-0/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"flag\\", ctx['state'].flag);
|
|
|
|
|
if (ctx['flag']==='if') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 2);
|
|
|
|
|
} else if (ctx['flag']==='elif') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 3);
|
|
|
|
|
} else {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 4);
|
|
|
|
|
}
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
return block1([d1]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set not altered by child comp 1`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 'called');
|
|
|
|
|
let d2 = ctx['iter'];
|
|
|
|
|
return block1([d1, d2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set not altered by child comp 2`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 'source');
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
let b2 = component(\`Childcomp\`, {}, key + \`__1\`, node, ctx);
|
|
|
|
|
let d2 = ctx['iter'];
|
|
|
|
|
return block1([d1, d2], [b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-set t-set outside modified in t-if 1`] = `
|
|
|
|
|
"function anonymous(bdom, helpers
|
|
|
|
|
) {
|
|
|
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
2021-11-15 15:01:56 +01:00
|
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
|
2021-10-19 11:00:26 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-0/><block-child-0/><p><block-text-0/></p></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
ctx = Object.create(ctx);
|
|
|
|
|
ctx[isBoundary] = 1
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 0);
|
|
|
|
|
setContextValue(ctx, \\"flag\\", ctx['state'].flag);
|
|
|
|
|
if (ctx['flag']==='if') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 2);
|
|
|
|
|
} else if (ctx['flag']==='elif') {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 3);
|
|
|
|
|
} else {
|
|
|
|
|
setContextValue(ctx, \\"iter\\", 4);
|
|
|
|
|
}
|
|
|
|
|
let d1 = ctx['iter'];
|
|
|
|
|
return block1([d1]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|