This commit is contained in:
Géry Debongnie
2023-02-21 15:12:19 +01:00
parent 56cfc6403d
commit 3ae81e9bee
4 changed files with 111 additions and 90 deletions
@@ -289,24 +289,24 @@ exports[`slots conditional slot 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
function slotFn1(ctx, node, key = \\"\\") {
function slot1(ctx, node, key = \\"\\") {
return text(\`blue\`);
}
function slotFn2(ctx, node, key = \\"\\") {
function slot2(ctx, node, key = \\"\\") {
return text(\`red\`);
}
return function template(ctx, node, key = \\"\\") {
let slot1 = {};
let slots1 = {};
if (ctx['state'].flag) {
const ctx1 = capture(ctx);
slot1['abc'] = {__render: slotFn1.bind(this), __ctx: ctx1};
slots1['abc'] = {__render: slot1.bind(this), __ctx: ctx1};
} else {
const ctx2 = capture(ctx);
slot1['abc'] = {__render: slotFn2.bind(this), __ctx: ctx2};
slots1['abc'] = {__render: slot2.bind(this), __ctx: ctx2};
}
const b4 = comp1({slots: markRaw(slot1)}, key + \`__1\`, node, this, null);
return comp1({slots: markRaw(slots1)}, key + \`__1\`, node, this, null);
}
}"
`;
@@ -1476,7 +1476,8 @@ exports[`slots simple default slot 1`] = `
}
return function template(ctx, node, key = \\"\\") {
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
let slots1 = markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}});
return comp1({slots: slots1}, key + \`__1\`, node, this, null);
}
}"
`;
@@ -1575,7 +1576,8 @@ exports[`slots simple default slot, variation 1`] = `
}
return function template(ctx, node, key = \\"\\") {
return comp1({slots: markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}})}, key + \`__1\`, node, this, null);
let slots1 = markRaw({'default': {__render: slot1.bind(this), __ctx: ctx}});
return comp1({slots: slots1}, key + \`__1\`, node, this, null);
}
}"
`;
@@ -2882,16 +2884,23 @@ 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;
let { markRaw, capture } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
const b2 = text(\` some text \`);
const ctx2 = capture(ctx);
return multi([b2]);
}
function slot2(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);
let slots1 = markRaw({'default': {__render: slot1.bind(this), __ctx: ctx1}});
return comp1({slots: slots1}, key + \`__1\`, node, this, null);
}
}"
`;