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

1325 lines
38 KiB
Plaintext
Raw Normal View History

2020-11-26 16:45:25 +01:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`basics GrandChild display is controlled by its GrandParent 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(null, false, false, false, false);
return function template(ctx, node, key = \\"\\") {
const Comp1 = ctx['myComp'];
return toggler(Comp1, comp1({displayGrandChild: ctx['displayGrandChild']}, key + \`__1\`, node, this, Comp1));
}
}"
`;
exports[`basics GrandChild display is controlled by its GrandParent 2`] = `
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(\`GrandChild\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['props'].displayGrandChild) {
b2 = comp1({}, key + \`__1\`, node, this, null);
}
return multi([b2]);
}
}"
`;
exports[`basics GrandChild display is controlled by its GrandParent 3`] = `
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/>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`basics Multi root component 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;
2020-11-26 16:45:25 +01:00
let block2 = createBlock(\`<span>1</span>\`);
let block4 = createBlock(\`<span>2</span>\`);
return function template(ctx, node, key = \\"\\") {
const b2 = block2();
const b3 = text(\`text\`);
const b4 = block4();
2020-11-26 16:45:25 +01:00
return multi([b2, b3, b4]);
}
}"
`;
exports[`basics a class component inside a class component, no external dom 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);
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
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics a class component inside a class component, no external dom 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div>simple vnode</div>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics a component cannot be mounted in a detached node (even if node is detached later) 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/>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`basics a component inside a component 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);
2020-11-26 16:45:25 +01:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span><block-child-0/></span>\`);
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 a component inside a component 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div>simple vnode</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[`basics can be clicked on and updated 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-text-0/><button block-handler-1=\\"click\\">Inc</button></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].counter;
2020-11-26 16:45:25 +01:00
const v1 = ctx['state'];
let hdlr1 = [()=>v1.counter++, ctx];
return block1([txt1, hdlr1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics can handle empty props 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
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({val: undefined}, 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 can handle empty props 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
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 = \\"\\") {
let txt1 = ctx['props'].val;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-10-21 10:13:08 +02:00
exports[`basics can inject values in tagged templates 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2022-05-26 15:09:09 +02:00
const callTemplate_1 = app.getTemplate(\`__template__999\`);
2021-10-21 10:13:08 +02:00
return function template(ctx, node, key = \\"\\") {
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
2021-10-21 10:13:08 +02:00
}
}"
`;
exports[`basics can inject values in tagged templates 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
2021-10-21 10:13:08 +02:00
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].n;
return block1([txt1]);
2021-10-21 10:13:08 +02:00
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`basics can mount a component with just some text 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;
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return text(\`just text\`);
}
}"
`;
exports[`basics can mount a component with no text 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;
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return text(\`\`);
}
}"
`;
exports[`basics can mount a simple component 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span>simple vnode</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics can mount a simple component with multiple roots 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;
2020-11-26 16:45:25 +01:00
let block2 = createBlock(\`<span/>\`);
let block3 = createBlock(\`<div/>\`);
return function template(ctx, node, key = \\"\\") {
const b2 = block2();
const b3 = block3();
2020-11-26 16:45:25 +01:00
return multi([b2, b3]);
}
}"
`;
exports[`basics can mount a simple component with props 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['props'].value;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics child can be updated 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({value: ctx['state'].counter}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics child can be updated 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
return function template(ctx, node, key = \\"\\") {
2021-12-20 11:19:59 +01:00
return text(ctx['props'].value);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics class component with dynamic text 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span>My value: <block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['value'];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics class parent, class child component with props 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({value: 42}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics class parent, class child component with props 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
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 = \\"\\") {
let txt1 = ctx['props'].value;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics component children doesn't leak (if case) 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, true);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['ifVar']) {
b2 = comp1({}, key + \`__1\`, node, this, null);
}
return multi([b2]);
}
}"
`;
exports[`basics component children doesn't leak (if case) 2`] = `
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/>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics component children doesn't leak (t-key case) 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, true);
return function template(ctx, node, key = \\"\\") {
const tKey_1 = ctx['keyVar'];
return toggler(tKey_1, comp1({}, tKey_1 + key + \`__1\`, node, this, null));
}
}"
`;
exports[`basics component children doesn't leak (t-key case) 2`] = `
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/>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`basics component with dynamic content can be updated 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['value'];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics do not remove previously rendered dom if not necessary 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div/>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics do not remove previously rendered dom if not necessary, variation 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><h1>h1</h1><span><block-text-0/></span></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].value;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics higher order components parent and child 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({child: ctx['state'].child}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics higher order components parent and child 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(\`ChildA\`, true, false, false, true);
const comp2 = app.createComponent(\`ChildB\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (ctx['props'].child==='a') {
b2 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
} else {
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 higher order components parent and child 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(\`<div>a</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[`basics higher order components parent and child 4`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>b</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics list of two sub components inside other nodes 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`SubWidget\`, true, false, false, true);
const comp2 = app.createComponent(\`SubWidget\`, true, false, false, true);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips);;
for (let i1 = 0; i1 < l_block2; i1++) {
ctx[\`blip\`] = v_block2[i1];
const key1 = ctx['blip'].id;
const b4 = comp1({}, key + \`__1__\${key1}\`, node, this, null);
const b5 = comp2({}, key + \`__2__\${key1}\`, node, this, null);
c_block2[i1] = withKey(block3([], [b4, b5]), key1);
}
const b2 = list(c_block2);
return block1([], [b2]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics list of two sub components inside other nodes 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>asdf</span>\`);
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[`basics parent, child and grandchild 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);
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
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics parent, child and grandchild 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(\`GrandChild\`, 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
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics parent, child and grandchild 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(\`<div>hey</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[`basics props is set on root component 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;
2020-11-26 16:45:25 +01:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>simple vnode</span>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics props value are own property of props object 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<span>simple vnode</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics props value are own property of props object, even with default values 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<span>simple vnode</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics reconciliation alg is not confused in some specific situation 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(\`Child\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
return function template(ctx, node, key = \\"\\") {
const b2 = comp1({}, key + \`__1\`, node, this, null);
const tKey_1 = 4;
const b3 = toggler(tKey_1, comp2({}, tKey_1 + key + \`__2\`, node, this, null));
2020-11-26 16:45:25 +01:00
return block1([], [b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics reconciliation alg is not confused in some specific situation 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>child</span>\`);
return function template(ctx, node, key = \\"\\") {
2021-12-20 11:19:59 +01:00
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics rerendering a widget with a sub widget 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(\`Counter\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
return comp1({}, key + \`__1\`, node, this, null);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics rerendering a widget with 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div><block-text-0/><button block-handler-1=\\"click\\">Inc</button></div>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].counter;
2021-12-20 11:19:59 +01:00
const v1 = ctx['state'];
let hdlr1 = [()=>v1.counter++, ctx];
return block1([txt1, hdlr1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics same t-keys in two different places 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);
const comp2 = app.createComponent(\`Child\`, true, false, false, false);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><div><block-child-0/></div><div><block-child-1/></div></div>\`);
return function template(ctx, node, key = \\"\\") {
const tKey_1 = 1;
const b2 = toggler(tKey_1, comp1({blip: '1'}, tKey_1 + key + \`__1\`, node, this, null));
const tKey_2 = 1;
const b3 = toggler(tKey_2, comp2({blip: '2'}, tKey_2 + key + \`__2\`, node, this, null));
2020-11-26 16:45:25 +01:00
return block1([], [b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics same t-keys in two different places 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
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 = \\"\\") {
let txt1 = ctx['props'].blip;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics simple component with a dynamic text 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;
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['value'];
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics simple component, useState 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;
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 = \\"\\") {
let txt1 = ctx['state'].value;
return block1([txt1]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics some simple sanity checks (el/status) 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>simple vnode</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics sub components between t-ifs 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, true);
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><span><block-child-2/></span><block-child-3/></div>\`);
let block2 = createBlock(\`<h1>hey</h1>\`);
let block3 = createBlock(\`<h2>noo</h2>\`);
let block5 = createBlock(\`<span>test</span>\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3,b4,b5;
if (ctx['state'].flag) {
b2 = block2();
} else {
b3 = block3();
}
b4 = comp1({}, key + \`__1\`, node, this, null);
if (ctx['state'].flag) {
b5 = block5();
}
return block1([], [b2, b3, b4, b5]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics sub components between t-ifs 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>child</span>\`);
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[`basics t-elif works with t-component 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);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
let block2 = createBlock(\`<div>somediv</div>\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (ctx['state'].flag) {
b2 = block2();
} else if (!ctx['state'].flag) {
b3 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
return block1([], [b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-elif works with t-component 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>hey</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-else with empty string works with t-component 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);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
let block2 = createBlock(\`<div>somediv</div>\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (ctx['state'].flag) {
b2 = block2();
} else {
b3 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
return block1([], [b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-else with empty string works with t-component 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>hey</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-else works with t-component 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);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
let block2 = createBlock(\`<div>somediv</div>\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (ctx['state'].flag) {
b2 = block2();
} else {
b3 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
return block1([], [b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-else works with t-component 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>hey</span>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-if works with t-component 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);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].flag) {
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[`basics t-if works with t-component 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>hey</span>\`);
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[`basics t-key on a component with t-if, and a sibling component 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(\`Child\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><block-child-0/><block-child-1/></div>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
let b2,b3;
if (false) {
const tKey_1 = 'str';
b2 = toggler(tKey_1, comp1({}, tKey_1 + key + \`__1\`, node, this, null));
2020-11-26 16:45:25 +01:00
}
b3 = comp2({}, key + \`__2\`, node, this, null);
2020-11-26 16:45:25 +01:00
return block1([], [b2, b3]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics t-key on a component with t-if, and a sibling component 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>child</span>\`);
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[`basics text after a conditional component 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);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><span><block-text-0/></span></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].hasChild) {
b2 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
let txt1 = ctx['state'].text;
return block1([txt1], [b2]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics text after a conditional component 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<p>simple vnode</p>\`);
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[`basics three level of components with collapsing root nodes 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);
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
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics three level of components with collapsing root nodes 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(\`GrandChild\`, 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
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics three level of components with collapsing root nodes 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(\`<div>2</div>\`);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`basics two child components 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(\`Child\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
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 multi([b2, b3]);
2020-11-26 16:45:25 +01:00
}
}"
`;
exports[`basics two child components 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div>simple vnode</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-11-13 17:10:06 +01:00
exports[`basics update props of component without concrete own node 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-11-13 17:10:06 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, true, false);
2021-11-13 17:10:06 +01:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
2021-11-13 17:10:06 +01:00
return function template(ctx, node, key = \\"\\") {
2021-12-20 11:19:59 +01:00
const tKey_1 = ctx['childProps'].key;
const b2 = toggler(tKey_1, comp1(Object.assign({}, ctx['childProps']), tKey_1 + key + \`__1\`, node, this, null));
2021-12-20 11:19:59 +01:00
return block1([], [b2]);
2021-11-13 17:10:06 +01:00
}
}"
`;
exports[`basics update props of component without concrete own node 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-11-13 17:10:06 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Custom\`, true, false, false, false);
2021-11-13 17:10:06 +01:00
return function template(ctx, node, key = \\"\\") {
const tKey_1 = ctx['props'].subKey;
return toggler(tKey_1, comp1({key: ctx['props'].key,subKey: ctx['props'].subKey}, tKey_1 + key + \`__1\`, node, this, null));
2021-11-13 17:10:06 +01:00
}
}"
`;
exports[`basics update props of component without concrete own node 3`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-11-13 17:10:06 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-11-13 17:10:06 +01:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<div class=\\"widget-subkey\\"><block-text-0/>__<block-text-1/></div>\`);
2021-11-13 17:10:06 +01:00
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['props'].key;
let txt2 = ctx['props'].subKey;
return block1([txt1, txt2]);
2021-11-13 17:10:06 +01:00
}
}"
`;
2020-11-26 16:45:25 +01:00
exports[`basics updating a component with t-foreach as root 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;
let { prepareList, withKey } = helpers;
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']);;
for (let i1 = 0; i1 < l_block1; i1++) {
ctx[\`item\`] = v_block1[i1];
const key1 = ctx['item'];
c_block1[i1] = withKey(text(ctx['item']), key1);
2020-11-26 16:45:25 +01:00
}
return list(c_block1);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-10-21 10:13:08 +02:00
exports[`basics updating widget immediately 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
2021-10-21 10:13:08 +02:00
return function template(ctx, node, key = \\"\\") {
return comp1({flag: ctx['state'].flag}, key + \`__1\`, node, this, null);
2021-10-21 10:13:08 +02:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics updating widget immediately 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
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<span>abc<block-child-0/></span>\`);
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['props'].flag) {
b2 = text(\`def\`);
}
return block1([], [b2]);
2020-11-26 16:45:25 +01:00
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics widget after a t-foreach 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;
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`SomeComponent\`, true, false, false, true);
2020-11-26 16:45:25 +01:00
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));;
for (let i1 = 0; i1 < l_block2; i1++) {
ctx[\`elem\`] = v_block2[i1];
2020-11-26 16:45:25 +01:00
ctx[\`elem_index\`] = i1;
const key1 = ctx['elem_index'];
c_block2[i1] = withKey(text(\`txt\`), key1);
2020-11-26 16:45:25 +01:00
}
ctx = ctx.__proto__;
const b2 = list(c_block2);
const b4 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
return block1([], [b2, b4]);
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics widget after a t-foreach 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
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 = \\"\\") {
return block1();
}
}"
`;
2021-12-20 11:19:59 +01:00
exports[`basics zero or one child components 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);
2020-11-26 16:45:25 +01:00
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].hasChild) {
b2 = comp1({}, key + \`__1\`, node, this, null);
2020-11-26 16:45:25 +01:00
}
return multi([b2]);
}
}"
`;
2021-10-21 10:13:08 +02:00
2021-12-20 11:19:59 +01:00
exports[`basics zero or one child components 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
let block1 = createBlock(\`<div>simple vnode</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`mount targets can mount a component (with default position='last-child') 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>app</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`mount targets can mount a component (with position='first-child') 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>app</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
exports[`mount targets default mount option is 'last-child' 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>app</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-12-20 17:32:32 +01:00
exports[`mount targets mount function: can mount a component (with default position='last-child') 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-12-20 17:32:32 +01:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
2021-12-20 17:32:32 +01:00
let block1 = createBlock(\`<div>app</div>\`);
return function template(ctx, node, key = \\"\\") {
return block1();
}
}"
`;
2021-10-21 10:13:08 +02:00
exports[`support svg components add proper namespace to svg 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`GComp\`, true, false, false, true);
2021-10-21 10:13:08 +02:00
2021-12-20 11:19:59 +01:00
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><block-child-0/></svg>\`);
2021-10-21 10:13:08 +02: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]);
2021-10-21 10:13:08 +02:00
}
}"
`;
exports[`support svg components add proper namespace to svg 2`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +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(\`<g block-ns=\\"http://www.w3.org/2000/svg\\"><circle cx=\\"50\\" cy=\\"50\\" r=\\"4\\" stroke=\\"green\\" stroke-width=\\"1\\" fill=\\"yellow\\"/></g>\`);
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-15 15:01:56 +01:00
exports[`t-out in components can render list of t-out 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, safeOutput, withKey } = helpers;
2021-10-21 10:13:08 +02:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].items);;
2021-10-21 10:13:08 +02:00
for (let i1 = 0; i1 < l_block2; i1++) {
ctx[\`item\`] = v_block2[i1];
const key1 = ctx['item'];
const b4 = text(ctx['item']);
const b5 = safeOutput(ctx['item']);
2021-10-21 10:13:08 +02:00
c_block2[i1] = withKey(multi([b4, b5]), key1);
}
const b2 = list(c_block2);
2021-10-21 10:13:08 +02:00
return block1([], [b2]);
}
}"
`;
exports[`t-out in components can switch the contents of two t-out repeatedly 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { safeOutput } = helpers;
return function template(ctx, node, key = \\"\\") {
const b2 = safeOutput(ctx['state'].a);
const b3 = safeOutput(ctx['state'].b);
return multi([b2, b3]);
}
}"
`;
2021-11-15 15:01:56 +01:00
exports[`t-out in components update properly on state changes 1`] = `
2022-05-26 15:09:09 +02:00
"function anonymous(app, bdom, helpers
2021-10-21 10:13:08 +02:00
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { safeOutput } = helpers;
2021-10-21 10:13:08 +02:00
let block1 = createBlock(\`<div><block-child-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
const b2 = safeOutput(ctx['state'].value);
2021-10-21 10:13:08 +02:00
return block1([], [b2]);
}
}"
`;