mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
df59ec49ae
t-call-context is a feature that's supposed to mask the rendering context completely, but currently the component remains available through `this`. This commit stops treating `this` as a reserved word, so that it's compiled to a lookup in the rendering context, and adds `this` to the rendering context when binding the component's rendering function. With these changes, `this` behaves the same as before when outside a t-call-context, but when the rendering context is overriden, the template can no longer access `this`. `this` still represents the instance of the component inside of the rendering function since it's needed by owl internally. A side-effect of this change is that now the rendering context is no longer the instance of the component by default, but is always an object with the component in its prototype chain. This was already the case before in some contexts (eg inside t-foreach, or inside components with a t-set/t-call anywhere in its template). This can cause issues in rare cases when a component method was called directly on the rendering context, as before this change, the method's bound this would be the component instance (except in a t-foreach, component with a t-set/t-call, etc), while after this change it is now never the component instance. When the method only reads on `this` there is no issue as all the components properties are available on the rendering contexts, but setting a value on `this` will write on the rendering context and not the component which is likely a mistake. While this is a breaking change, simply adding a t-set/t-call to any template would break components that would be broken by this change, with this in mind we decided to make this change anyway so that developers get the error as early as possible in the development cycle rather than having a seemingly inocuous change break code under them.
3184 lines
101 KiB
Plaintext
3184 lines
101 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`slots can define a default content 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, false, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define a default content 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\`default content\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1.bind(this));
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define and call slots 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<span>header</span>\`);
|
|
let block3 = createBlock(\`<span>footer</span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block2();
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return block3();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b4 = comp1({slots: markRaw({'header': {__render: slot1.bind(this), __ctx: ctx1}, 'footer': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define and call slots 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><div><block-child-0/></div><div><block-child-1/></div></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'header', false, {});
|
|
const b3 = callSlot(ctx, node, key, 'footer', false, {});
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define and call slots with bound params 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, bind, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`abc\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'abc': {__render: slot1.bind(this), __ctx: ctx1, getValue: bind(this, ctx['getValue'])}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define and call slots with bound params 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'abc', false, {});
|
|
const b3 = text(ctx['props'].slots['abc'].getValue());
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define and call slots with params 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<span>header</span>\`);
|
|
let block3 = createBlock(\`<span>footer</span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block2();
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return block3();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b4 = comp1({slots: markRaw({'header': {__render: slot1.bind(this), __ctx: ctx1, param: ctx['var']}, 'footer': {__render: slot2.bind(this), __ctx: ctx1, param: '5'}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can define and call slots with params 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/><div><block-child-0/></div><block-text-1/><div><block-child-1/></div></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].slots['header'].param;
|
|
const b2 = callSlot(ctx, node, key, 'header', false, {});
|
|
let txt2 = ctx['props'].slots['footer'].param;
|
|
const b3 = callSlot(ctx, node, key, 'footer', false, {});
|
|
return block1([txt1, txt2], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can render node with t-ref and Component in same slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const refs = this.__owl__.refs;
|
|
const ref1 = (el) => refs[\`div\`] = el;
|
|
const b2 = block2([ref1]);
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can render node with t-ref and Component in same slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can render only empty slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can use component in default-content of t-slot 1`] = `
|
|
"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 = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can use component in default-content of t-slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {}, defaultContent1.bind(this));
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can use component in default-content of t-slot 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(\`\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can use t-call in default-content of t-slot 1`] = `
|
|
"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 = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can use t-call in default-content of t-slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {}, defaultContent1.bind(this));
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots can use t-call in default-content of t-slot 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(\`\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots content is the default slot (variation) 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<span>sts rocks</span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots content is the default slot (variation) 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots content is the default slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<span>sts rocks</span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block2();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots content is the default slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default content is not rendered if named slot is provided 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`hey\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'header': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default content is not rendered if named slot is provided 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\`default content\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1.bind(this));
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default content is not rendered if slot is provided 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`hey\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default content is not rendered if slot is provided 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\`default content\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1.bind(this));
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot next to named slot, with default content 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\` Overridden footer \`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'footer': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot next to named slot, with default content 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div class=\\"Dialog\\"><div class=\\"content\\"><block-child-0/></div><div class=\\"footer\\"><block-child-1/></div></div>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\` Default content \`);
|
|
}
|
|
|
|
function defaultContent2(ctx, node, key = \\"\\") {
|
|
return text(\` Default footer \`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1.bind(this));
|
|
const b5 = callSlot(ctx, node, key, 'footer', false, {}, defaultContent2.bind(this));
|
|
return block1([], [b3, b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot with params with - in it 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(ctx['slotScope']['some-value']);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot with params with - in it 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {'some-value': ctx['state'].value});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot with slot scope: shorthand syntax 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let b2,b3;
|
|
if (ctx['slotScope'].bool) {
|
|
b2 = text(\`some text\`);
|
|
} else {
|
|
b3 = text(\`other text\`);
|
|
}
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot with slot scope: shorthand syntax 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {bool: ctx['state'].bool});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot work with text nodes (variation) 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`sts rocks\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot work with text nodes (variation) 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot work with text nodes 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`sts rocks\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots default slot work with text nodes 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic slot in multiple locations 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Slotter\`, true, true, false, false);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b2 = text(\`hello \`);
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp2({location: ctx['state'].location,slots: markRaw({'coffee': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic slot in multiple locations 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block2 = createBlock(\`<p><block-child-0/></p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2,b4;
|
|
if (ctx['props'].location===1) {
|
|
const slot1 = ('coffee');
|
|
const b3 = toggler(slot1, callSlot(ctx, node, key + \`__1\`, slot1, true, {}));
|
|
b2 = block2([], [b3]);
|
|
}
|
|
if (ctx['props'].location===2) {
|
|
const slot2 = ('coffee');
|
|
b4 = toggler(slot2, callSlot(ctx, node, key + \`__2\`, slot2, true, {}));
|
|
}
|
|
return multi([b2, b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic slot in multiple locations 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div>child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic t-slot call 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Toggler\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<p>slot1</p>\`);
|
|
let block4 = createBlock(\`<span>content</span>\`);
|
|
let block5 = createBlock(\`<h1>slot2</h1>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b3 = block3();
|
|
const b4 = block4();
|
|
return multi([b3, b4]);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return block5();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b6 = comp1({slots: markRaw({'slot1': {__render: slot1.bind(this), __ctx: ctx1}, 'slot2': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b6]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic t-slot call 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-child-0/></button>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['toggle'], ctx];
|
|
const slot1 = (ctx['current'].slot);
|
|
const b2 = toggler(slot1, callSlot(ctx, node, key + \`__1\`, slot1, true, {}));
|
|
return block1([hdlr1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic t-slot call with default 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Toggler\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<p>slot1</p>\`);
|
|
let block4 = createBlock(\`<span>content</span>\`);
|
|
let block5 = createBlock(\`<h1>slot2</h1>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b3 = block3();
|
|
const b4 = block4();
|
|
return multi([b3, b4]);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return block5();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b6 = comp1({slots: markRaw({'slot1': {__render: slot1.bind(this), __ctx: ctx1}, 'slot2': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b6]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots dynamic t-slot call with default 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-child-0/></button>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\` owl \`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['toggle'], ctx];
|
|
const b3 = callSlot(ctx, node, key + \`__1\`, (ctx['current'].slot), true, {}, defaultContent1.bind(this));
|
|
return block1([hdlr1], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots fun: two calls to the same slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`some text\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots fun: two calls to the same slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
const b3 = callSlot(ctx, node, key + \`__1\`, 'default', false, {});
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots missing slots are ignored 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, false, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots missing slots are ignored 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/><span>some content</span><block-child-1/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
const b3 = callSlot(ctx, node, key, 'footer', false, {});
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`P\`, true, false, false, true);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`A\`, true, false, false, false);
|
|
|
|
let block2 = createBlock(\`<button block-handler-0=\\"click\\">inc</button>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['inc'], ctx];
|
|
const b2 = block2([hdlr1]);
|
|
const b3 = comp1({number: ctx['state'].number}, key + \`__1\`, node, this, null);
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`__template__1002\`);
|
|
const comp1 = app.createComponent(\`B\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b2 = text(\`[A]\`);
|
|
const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 4`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`__template__1001\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
const b2 = text(\`[sub1] \`);
|
|
setContextValue(ctx, \\"dummy\\", ctx['validate']);
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1;
|
|
setContextValue(ctx, \\"v\\", ctx['props'].number);
|
|
const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 5`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = text(\`[sub2\`);
|
|
const b3 = text(ctx['v']);
|
|
const b4 = text(\`]\`);
|
|
return multi([b2, b3, b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 6`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`C\`, true, false, false, false);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = text(\`[B]\`);
|
|
const b3 = comp1({slots: ctx['props'].slots}, key + \`__1\`, node, this, null);
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots mix of slots, t-call, t-call with body, and giving own props child 7`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = text(\`[C]\`);
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple roots are allowed in a default slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<span>sts</span>\`);
|
|
let block4 = createBlock(\`<span>rocks</span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b3 = block3();
|
|
const b4 = block4();
|
|
return multi([b3, b4]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b5 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple roots are allowed in a default slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple roots are allowed in a named slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<span>sts</span>\`);
|
|
let block4 = createBlock(\`<span>rocks</span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b3 = block3();
|
|
const b4 = block4();
|
|
return multi([b3, b4]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b5 = comp1({slots: markRaw({'content': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple roots are allowed in a named slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'content', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple slots containing components 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`C\`, true, false, false, false);
|
|
const comp2 = app.createComponent(\`C\`, true, false, false, false);
|
|
const comp3 = app.createComponent(\`B\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({val: 1}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return comp2({val: 2}, key + \`__2\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp3({slots: markRaw({'s1': {__render: slot1.bind(this), __ctx: ctx1}, 's2': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__3\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple slots containing components 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 's1', false, {});
|
|
const b3 = callSlot(ctx, node, key, 's2', false, {});
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots multiple slots containing components 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].val;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slot inside slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<p>A<block-text-0/></p>\`);
|
|
let block3 = createBlock(\`<p>B<block-text-0/></p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['value'];
|
|
return block2([txt1]);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
const ctx2 = capture(ctx);
|
|
return comp1({slots: markRaw({'brol': {__render: slot3.bind(this), __ctx: ctx2}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
function slot3(ctx, node, key = \\"\\") {
|
|
let txt2 = ctx['value'];
|
|
return block3([txt2]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b5 = comp2({slots: markRaw({'brol': {__render: slot1.bind(this), __ctx: ctx1}, 'default': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slot inside slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'brol', false, {});
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slot inside slot, part 3 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<p>A<block-text-0/></p>\`);
|
|
let block3 = createBlock(\`<p>B<block-text-0/></p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['value'];
|
|
return block2([txt1]);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
const ctx2 = capture(ctx);
|
|
return comp1({slots: markRaw({'brol': {__render: slot3.bind(this), __ctx: ctx2}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
function slot3(ctx, node, key = \\"\\") {
|
|
let txt2 = ctx['value'];
|
|
return block3([txt2]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b5 = comp2({slots: markRaw({'brol': {__render: slot1.bind(this), __ctx: ctx1}, 'default': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slot inside slot, part 3 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'brol', false, {});
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slots can define a default content 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, false, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slots can define a default content 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\`default content\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1.bind(this));
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slots inside slot, again 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<p>A<block-text-0/></p>\`);
|
|
let block3 = createBlock(\`<p>B<block-text-0/></p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['value'];
|
|
return block2([txt1]);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
const ctx2 = capture(ctx);
|
|
return comp1({slots: markRaw({'brol2': {__render: slot3.bind(this), __ctx: ctx2}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
function slot3(ctx, node, key = \\"\\") {
|
|
let txt2 = ctx['value'];
|
|
return block3([txt2]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b5 = comp2({slots: markRaw({'brol1': {__render: slot1.bind(this), __ctx: ctx1}, 'default': {__render: slot2.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b5]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots named slots inside slot, again 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<child><block-child-0/><block-child-1/><block-child-2/></child>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\`default1\`);
|
|
}
|
|
|
|
function defaultContent2(ctx, node, key = \\"\\") {
|
|
return text(\`default2\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'brol1', false, {}, defaultContent1.bind(this));
|
|
const b5 = callSlot(ctx, node, key, 'brol2', false, {}, defaultContent2.bind(this));
|
|
const b6 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b3, b5, b6]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots in same template 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child3\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Child2\`, true, true, false, true);
|
|
const comp3 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<span id=\\"parent\\"><block-child-0/></span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp2({slots: markRaw({'default': {__render: slot2.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b4 = comp3({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__3\`, node, this, null);
|
|
return block1([], [b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots in same template 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span id=\\"c1\\"><div><block-child-0/></div></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots in same template 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span id=\\"c2\\"><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots in same template 4`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<span>Child 3</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots: evaluation context and parented relationship 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Slot\`, true, false, false, false);
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots: evaluation context and parented relationship 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`GrandChild\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots: evaluation context and parented relationship 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots nested slots: evaluation context and parented relationship 4`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].val;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots no named slot content => just no children 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, false, false, true);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots no named slot content => just no children 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'header', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`some text\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot with params 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let b2,b3;
|
|
if (ctx['slotScope'].bool) {
|
|
b2 = text(\`some text\`);
|
|
} else {
|
|
b3 = text(\`other text\`);
|
|
}
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot with params 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {bool: ctx['state'].bool});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot with params and bound function 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(ctx['slotScope'].fn());
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot with params and bound function 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot, bind } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {fn: bind(this, ctx['getValue'])});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot, variation 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`some text\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple default slot, variation 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple dynamic slot with slot scope 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let b2,b3;
|
|
if (ctx['slotScope'].bool) {
|
|
b2 = text(\`some text\`);
|
|
} else {
|
|
b3 = text(\`other text\`);
|
|
}
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'slotName': {__render: slot1.bind(this), __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple dynamic slot with slot scope 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const slot1 = ('slotName');
|
|
const b2 = toggler(slot1, callSlot(ctx, node, key + \`__1\`, slot1, true, {bool: ctx['state'].bool}));
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple named and empty slot -- 2 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'myEmptySlot': {myProp: 'myProp text'}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple named and empty slot -- 2 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
return text(\`default empty\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = callSlot(ctx, node, key, 'myEmptySlot', false, {}, defaultContent1.bind(this));
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple named and empty slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`some text\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'myEmptySlot': {}, 'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple named and empty slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/><block-child-1/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
const b3 = callSlot(ctx, node, key, 'myEmptySlot', false, {});
|
|
return block1([], [b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple slot with slot scope 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let b2,b3;
|
|
if (ctx['slotScope'].bool) {
|
|
b2 = text(\`some text\`);
|
|
} else {
|
|
b3 = text(\`other text\`);
|
|
}
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'slotName': {__render: slot1.bind(this), __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots simple slot with slot scope 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'slotName', false, {bool: ctx['state'].bool});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and (inline) t-call 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and (inline) t-call 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<p>sokka</p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and (inline) t-call 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and t-call 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and t-call 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<p>sokka</p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and t-call 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and t-esc 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text('toph');
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot and t-esc 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot are properly rendered if inner props are changed 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`SomeComponent\`, true, false, false, false);
|
|
const comp2 = app.createComponent(\`GenericComponent\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><button block-handler-0=\\"click\\">Inc[<block-text-1/>]</button><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['inc'], ctx];
|
|
let txt1 = ctx['state'].val;
|
|
const b3 = comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
return block1([hdlr1, txt1], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot are properly rendered if inner props are changed 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot are properly rendered if inner props are changed 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div> SC:<block-text-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].val;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content has different key from other content -- dynamic slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
|
const comp2 = app.createComponent(\`SlotDisplay\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({parent: 'Parent'}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content has different key from other content -- dynamic slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = comp1({parent: 'SlotDisplay'}, key + \`__1\`, node, this, null);
|
|
const slot1 = (ctx['slotName']);
|
|
const b3 = toggler(slot1, callSlot(ctx, node, key + \`__2\`, slot1, true, {}));
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content has different key from other content -- dynamic slot 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].parent;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content has different key from other content -- static slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
|
const comp2 = app.createComponent(\`SlotDisplay\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({parent: 'Parent'}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content has different key from other content -- static slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = comp1({parent: 'SlotDisplay'}, key + \`__1\`, node, this, null);
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content has different key from other content -- static slot 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].parent;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content is bound to caller (variation) 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, isBoundary, withDefault, setContextValue, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\">some text</button>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"var\\", 1);
|
|
const v1 = ctx['this'];
|
|
let hdlr1 = [()=>v1.inc(), ctx];
|
|
return block1([hdlr1]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content is bound to caller (variation) 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content is bound to caller 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\">some text</button>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['inc'], ctx];
|
|
return block1([hdlr1]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot content is bound to caller 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot in multiple locations 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Slotter\`, true, true, false, false);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b2 = text(\` hello \`);
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp2({location: ctx['state'].location,slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot in multiple locations 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block2 = createBlock(\`<p><block-child-0/></p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2,b4;
|
|
if (ctx['props'].location===1) {
|
|
const b3 = callSlot(ctx, node, key, 'default', false, {});
|
|
b2 = block2([], [b3]);
|
|
}
|
|
if (ctx['props'].location===2) {
|
|
b4 = callSlot(ctx, node, key + \`__1\`, 'default', false, {});
|
|
}
|
|
return multi([b2, b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot in multiple locations 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div>child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot in t-foreach locations 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Slotter\`, true, true, false, false);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b2 = text(\` hello \`);
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp2({list: ctx['state'].list,slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot in t-foreach locations 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { prepareList, callSlot, withKey } = helpers;
|
|
|
|
let block2 = createBlock(\`<p><block-text-0/><block-child-0/></p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['props'].list);;
|
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
|
ctx[\`elem\`] = v_block1[i1];
|
|
ctx[\`elem_index\`] = i1;
|
|
const key1 = ctx['elem_index'];
|
|
let txt1 = ctx['elem'];
|
|
const b3 = callSlot(ctx, node, key1, 'default', false, {});
|
|
c_block1[i1] = withKey(block2([txt1], [b3]), key1);
|
|
}
|
|
return list(c_block1);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot in t-foreach locations 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div>child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(\`Grand Child\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship, even through t-call 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship, even through t-call 2`] = `
|
|
"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 = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship, even through t-call 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot preserves properly parented relationship, even through t-call 4`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return text(\`Grand Child\`);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot with slot scope and t-props 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block2 = createBlock(\`<p><block-text-0/></p>\`);
|
|
let block3 = createBlock(\`<p><block-text-0/></p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['info'].a;
|
|
const b2 = block2([txt1]);
|
|
let txt2 = ctx['info'].b;
|
|
const b3 = block3([txt2]);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'slotName': {__render: slot1.bind(this), __ctx: ctx1, __scope: \\"info\\"}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slot with slot scope and t-props 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'slotName', false, Object.assign({}, ctx['info']));
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots and wrapper components 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Link\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`hey\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots and wrapper components 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<a href=\\"abc\\"><block-child-0/></a>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are properly bound to correct component 1`] = `
|
|
"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 = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are properly bound to correct component 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot, isBoundary, withDefault, setContextValue } = helpers;
|
|
|
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-text-1/></button>\`);
|
|
|
|
function defaultContent1(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"var\\", 1);
|
|
const v1 = ctx['this'];
|
|
let hdlr1 = [()=>v1.increment(), ctx];
|
|
let txt1 = ctx['state'].value;
|
|
return block1([hdlr1, txt1]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {}, defaultContent1.bind(this));
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><span class=\\"counter\\"><block-text-0/></span><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<button block-handler-0=\\"click\\">do something</button>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['doSomething'], ctx];
|
|
return block2([hdlr1]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['state'].val;
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'footer': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([txt1], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'footer', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context, part 2 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { prepareList, capture, markRaw, withKey } = helpers;
|
|
const comp1 = app.createComponent(\`Link\`, true, true, false, false);
|
|
|
|
let block1 = createBlock(\`<div><u><block-child-0/></u></div>\`);
|
|
let block3 = createBlock(\`<li><block-child-0/></li>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b5 = text(\`User \`);
|
|
const b6 = text(ctx['user'].name);
|
|
return multi([b5, b6]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`user\`] = v_block2[i1];
|
|
const key1 = ctx['user'].id;
|
|
const ctx1 = capture(ctx);
|
|
const b7 = comp1({to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
|
|
c_block2[i1] = withKey(block3([], [b7]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context, part 2 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<a block-attribute-0=\\"href\\"><block-child-0/></a>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let attr1 = ctx['props'].to;
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([attr1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context, part 3 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { prepareList, isBoundary, withDefault, setContextValue, capture, markRaw, withKey } = helpers;
|
|
const comp1 = app.createComponent(\`Link\`, true, true, false, false);
|
|
|
|
let block1 = createBlock(\`<div><u><block-child-0/></u></div>\`);
|
|
let block3 = createBlock(\`<li><block-child-0/></li>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(ctx['userdescr']);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`user\`] = v_block2[i1];
|
|
const key1 = ctx['user'].id;
|
|
setContextValue(ctx, \\"userdescr\\", 'User '+ctx['user'].name);
|
|
const ctx1 = capture(ctx);
|
|
const b5 = comp1({to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
|
|
c_block2[i1] = withKey(block3([], [b5]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context, part 3 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<a block-attribute-0=\\"href\\"><block-child-0/></a>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let attr1 = ctx['props'].to;
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([attr1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context, part 4 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Link\`, true, true, false, false);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(ctx['userdescr']);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"userdescr\\", 'User '+ctx['state'].user.name);
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({to: '/user/'+ctx['state'].user.id,slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots are rendered with proper context, part 4 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<a block-attribute-0=\\"href\\"><block-child-0/></a>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let attr1 = ctx['props'].to;
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([attr1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in slots, with vars 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`A\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block2 = createBlock(\`<p>hey<block-text-0/></p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['test'];
|
|
return block2([txt1]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"test\\", ctx['state'].name);
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in slots, with vars 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`B\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in slots, with vars 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in t-foreach and re-rendering 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { prepareList, capture, markRaw, withKey } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(ctx['n_index']);
|
|
}
|
|
|
|
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[\`n\`] = v_block2[i1];
|
|
ctx[\`n_index\`] = i1;
|
|
const key1 = ctx['n_index'];
|
|
const ctx1 = capture(ctx);
|
|
c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in t-foreach and re-rendering 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-text-0/><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['state'].val;
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([txt1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in t-foreach in t-foreach 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { prepareList, capture, markRaw, withKey } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block4 = createBlock(\`<div><block-text-0/></div>\`);
|
|
let block5 = createBlock(\`<ul><block-child-0/></ul>\`);
|
|
let block7 = createBlock(\`<li><block-text-0/></li>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let txt2 = ctx['node1'].value;
|
|
return block7([txt2]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['tree']);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`node1\`] = v_block2[i1];
|
|
const key1 = ctx['node1'].key;
|
|
let txt1 = ctx['node1'].value;
|
|
const b4 = block4([txt1]);
|
|
ctx = Object.create(ctx);
|
|
const [k_block6, v_block6, l_block6, c_block6] = prepareList(ctx['node1'].nodes);;
|
|
for (let i2 = 0; i2 < l_block6; i2++) {
|
|
ctx[\`node2\`] = v_block6[i2];
|
|
const key2 = ctx['node2'].key;
|
|
const ctx1 = capture(ctx);
|
|
c_block6[i2] = withKey(comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1__\${key1}__\${key2}\`, node, this, null), key2);
|
|
}
|
|
ctx = ctx.__proto__;
|
|
const b6 = list(c_block6);
|
|
const b5 = block5([], [b6]);
|
|
c_block2[i1] = withKey(multi([b4, b5]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in t-foreach in t-foreach 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in t-foreach with t-set and re-rendering 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { prepareList, isBoundary, withDefault, setContextValue, capture, markRaw, withKey } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(ctx['dummy']);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
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[\`n\`] = v_block2[i1];
|
|
ctx[\`n_index\`] = i1;
|
|
const key1 = ctx['n_index'];
|
|
setContextValue(ctx, \\"dummy\\", ctx['n_index']);
|
|
const ctx1 = capture(ctx);
|
|
c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots slots in t-foreach with t-set and re-rendering 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-text-0/><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['state'].val;
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([txt1], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-debug on a t-set-slot (defining a slot) 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
debugger;
|
|
return text(\`abc\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'content': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-debug on a t-set-slot (defining a slot) 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'content', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-set t-value in a slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, isBoundary, withDefault, setContextValue, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"rainbow\\", 'dash');
|
|
return text(ctx['rainbow']);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-set t-value in a slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-set-slot=default has priority over rest of the content 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return text(\`some other text\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-set-slot=default has priority over rest of the content 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot in recursive templates 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, prepareList, isBoundary, withDefault, setContextValue, withKey, markRaw } = helpers;
|
|
const callTemplate_1 = app.getTemplate(\`_test_recursive_template\`);
|
|
const comp1 = app.createComponent(\`Wrapper\`, true, true, false, true);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
const b2 = text(ctx['name']);
|
|
ctx = Object.create(ctx);
|
|
const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['items']);;
|
|
for (let i1 = 0; i1 < l_block3; i1++) {
|
|
ctx[\`item\`] = v_block3[i1];
|
|
ctx[\`item_first\`] = i1 === 0;
|
|
ctx[\`item_last\`] = i1 === v_block3.length - 1;
|
|
ctx[\`item_index\`] = i1;
|
|
ctx[\`item_value\`] = k_block3[i1];
|
|
const key1 = ctx['item'].name;
|
|
let b5,b6;
|
|
if (!ctx['item'].children.length) {
|
|
b5 = text(ctx['item'].name);
|
|
} else {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1;
|
|
setContextValue(ctx, \\"name\\", ctx['item'].name);
|
|
setContextValue(ctx, \\"items\\", ctx['item'].children);
|
|
b6 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`);
|
|
ctx = ctx.__proto__;
|
|
}
|
|
c_block3[i1] = withKey(multi([b5, b6]), key1);
|
|
}
|
|
ctx = ctx.__proto__;
|
|
const b3 = list(c_block3);
|
|
return multi([b2, b3]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot in recursive templates 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<wrapper><block-child-0/></wrapper>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot nested within another slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child3\`, true, false, false, true);
|
|
const comp2 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<span id=\\"c1\\"><block-child-0/></span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot nested within another slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Portal\`, true, true, false, true);
|
|
const comp2 = app.createComponent(\`Modal\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<span id=\\"c2\\"><block-child-0/></span>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot2.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
function slot2(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b4 = comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b4]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot nested within another slot 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span id=\\"modal\\"><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot nested within another slot 4`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<span id=\\"portal\\"><block-child-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot nested within another slot 5`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<span>Child 3</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot scope context 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<button>The Button</button>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot scope context 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot, markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Wrapper\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div block-handler-0=\\"click\\"><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['onClick'], ctx];
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([hdlr1], [b2]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot scope context 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot within dynamic t-call 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { capture, markRaw } = helpers;
|
|
const call = app.callTemplate.bind(app);
|
|
const comp1 = app.createComponent(\`Slotted\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const template1 = (ctx['tcallTemplate']);
|
|
return call(this, template1, ctx, node, key + \`__1\`);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const ctx1 = capture(ctx);
|
|
const b3 = comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot within dynamic t-call 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
let block1 = createBlock(\`<div class=\\"slotted\\"><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = callSlot(ctx, node, key, 'default', false, {});
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot within dynamic t-call 3`] = `
|
|
"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 class=\\"slot\\"><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots t-slot within dynamic t-call 4`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div class=\\"child\\"/>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots template can just return a slot 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
|
|
const comp2 = app.createComponent(\`SlotComponent\`, true, true, false, true);
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b3 = comp2({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__2\`, node, this, null);
|
|
return block1([], [b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots template can just return a slot 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'default', false, {});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`slots template can just return a slot 3`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].value;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|