mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] components: capture context in prop expressions
This commit is contained in:
committed by
Aaron Bohy
parent
c0cf2c9e3d
commit
7143dd3ff5
@@ -389,10 +389,9 @@ exports[`slots dynamic t-slot call 1`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-child-0/></button>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['toggle'];
|
||||
let d1 = [v1, ctx];
|
||||
const slot2 = (ctx['current'].slot);
|
||||
let b2 = toggler(slot2, callSlot(ctx, node, key, slot2));
|
||||
let d1 = [ctx['toggle'], ctx];
|
||||
const slot1 = (ctx['current'].slot);
|
||||
let b2 = toggler(slot1, callSlot(ctx, node, key, slot1));
|
||||
return block1([d1], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -436,14 +435,13 @@ exports[`slots dynamic t-slot call with default 1`] = `
|
||||
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-child-0/></button>\`);
|
||||
|
||||
const defaultSlot2 = ctx => {
|
||||
const defaultSlot1 = ctx => {
|
||||
return text(\` owl \`);
|
||||
}
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['toggle'];
|
||||
let d1 = [v1, ctx];
|
||||
let b3 = callSlot(ctx, node, key, (ctx['current'].slot), defaultSlot2, true);
|
||||
let d1 = [ctx['toggle'], ctx];
|
||||
let b3 = callSlot(ctx, node, key, (ctx['current'].slot), defaultSlot1, true);
|
||||
return block1([d1], [b3]);
|
||||
}
|
||||
}"
|
||||
@@ -1262,15 +1260,14 @@ exports[`slots slot are properly rendered if inner props are changed 3`] = `
|
||||
|
||||
let block1 = createBlock(\`<div><button block-handler-0=\\"click\\">Inc[<block-text-1/>]</button><block-child-0/></div>\`);
|
||||
|
||||
const slot3 = ctx => (node, key) => {
|
||||
return component(\`SomeComponent\`, {val: ctx['state'].val}, key + \`__4\`, node, ctx);
|
||||
const slot2 = ctx => (node, key) => {
|
||||
return component(\`SomeComponent\`, {val: ctx['state'].val}, key + \`__3\`, node, ctx);
|
||||
}
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const v1 = ctx['inc'];
|
||||
let d1 = [v1, ctx];
|
||||
let d1 = [ctx['inc'], ctx];
|
||||
let d2 = ctx['state'].val;
|
||||
let b3 = assign(component(\`GenericComponent\`, {}, key + \`__2\`, node, ctx), {slots: {'default': slot3(ctx)}});
|
||||
let b3 = assign(component(\`GenericComponent\`, {}, key + \`__1\`, node, ctx), {slots: {'default': slot2(ctx)}});
|
||||
return block1([d1, d2], [b3]);
|
||||
}
|
||||
}"
|
||||
@@ -1301,8 +1298,7 @@ exports[`slots slot content is bound to caller 2`] = `
|
||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">some text</button>\`);
|
||||
|
||||
const slot2 = ctx => (node, key) => {
|
||||
const v3 = ctx['inc'];
|
||||
let d1 = [v3, ctx];
|
||||
let d1 = [ctx['inc'], ctx];
|
||||
return block1([d1]);
|
||||
}
|
||||
|
||||
@@ -1472,8 +1468,7 @@ exports[`slots slots are rendered with proper context 2`] = `
|
||||
let block2 = createBlock(\`<button block-handler-0=\\"click\\">do something</button>\`);
|
||||
|
||||
const slot3 = ctx => (node, key) => {
|
||||
const v4 = ctx['doSomething'];
|
||||
let d2 = [v4, ctx];
|
||||
let d2 = [ctx['doSomething'], ctx];
|
||||
return block2([d2]);
|
||||
}
|
||||
|
||||
@@ -2083,8 +2078,7 @@ exports[`slots t-slot scope context 2`] = `
|
||||
let block1 = createBlock(\`<div block-handler-0=\\"click\\"><block-child-0/></div>\`);
|
||||
|
||||
const slot2 = ctx => (node, key) => {
|
||||
const v3 = ctx['onClick'];
|
||||
let d1 = [v3, ctx];
|
||||
let d1 = [ctx['onClick'], ctx];
|
||||
let b2 = callSlot(ctx, node, key, 'default');
|
||||
return block1([d1], [b2]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user