mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
31fce0926c
closes #1185
381 lines
12 KiB
Plaintext
381 lines
12 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`t-on t-on expression captured in t-foreach 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { isBoundary, withDefault, setContextValue, prepareList, withKey } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<div><button block-handler-0=\\"click\\">expr</button></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"iter\\", 0);
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['arr']);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`val\`] = v_block2[i1];
|
|
const key1 = ctx['val'];
|
|
const v1 = ctx['otherState'];
|
|
const v2 = ctx['iter'];
|
|
let hdlr1 = [()=>v1.vals.push(v2+'_'+v2), ctx];
|
|
setContextValue(ctx, \\"iter\\", ctx['iter']+1);
|
|
c_block2[i1] = withKey(block3([hdlr1]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on expression in t-foreach 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { prepareList, withKey } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<div><block-text-0/>: <block-text-1/><button block-handler-2=\\"click\\">Expr</button></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`val\`] = v_block2[i1];
|
|
ctx[\`val_index\`] = i1;
|
|
const key1 = ctx['val'];
|
|
let txt1 = ctx['val_index'];
|
|
let txt2 = ctx['val']+'';
|
|
const v1 = ctx['otherState'];
|
|
const v2 = ctx['val'];
|
|
let hdlr1 = [()=>v1.vals.push(v2), ctx];
|
|
c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on expression in t-foreach with t-set 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { isBoundary, withDefault, setContextValue, prepareList, withKey } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<div><block-text-0/>: <block-text-1/><button block-handler-2=\\"click\\">Expr</button></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
ctx[isBoundary] = 1
|
|
setContextValue(ctx, \\"bossa\\", 'nova');
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`val\`] = v_block2[i1];
|
|
ctx[\`val_index\`] = i1;
|
|
const key1 = ctx['val'];
|
|
setContextValue(ctx, \\"bossa\\", ctx['bossa']+'_'+ctx['val_index']);
|
|
let txt1 = ctx['val_index'];
|
|
let txt2 = ctx['val']+'';
|
|
const v1 = ctx['otherState'];
|
|
const v2 = ctx['val'];
|
|
const v3 = ctx['bossa'];
|
|
let hdlr1 = [()=>v1.vals.push(v2+'_'+v3), ctx];
|
|
c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on method call in t-foreach 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { prepareList, withKey } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
let block3 = createBlock(\`<div><block-text-0/>: <block-text-1/><button block-handler-2=\\"click\\">meth call</button></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
ctx = Object.create(ctx);
|
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);;
|
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
|
ctx[\`val\`] = v_block2[i1];
|
|
ctx[\`val_index\`] = i1;
|
|
const key1 = ctx['val'];
|
|
let txt1 = ctx['val_index'];
|
|
let txt2 = ctx['val']+'';
|
|
const v1 = ctx['val'];
|
|
let hdlr1 = [()=>this.addVal(v1), ctx];
|
|
c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1);
|
|
}
|
|
const b2 = list(c_block2);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on component next to t-on on div 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { createCatcher } = helpers;
|
|
const catcher1 = createCatcher({\\"click\\":0});
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/><p block-handler-0=\\"click\\">dec</p></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const hdlr1 = [ctx['increment'], ctx];
|
|
const b2 = catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]);
|
|
let hdlr2 = [ctx['decrement'], ctx];
|
|
return block1([hdlr2], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on component next to t-on on div 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<button><block-text-0/></button>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].value;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on components 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { createCatcher } = helpers;
|
|
const catcher1 = createCatcher({\\"click\\":0});
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const hdlr1 = [ctx['increment'], ctx];
|
|
return catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on components 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<button><block-text-0/></button>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].value;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on components, variation 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { createCatcher } = helpers;
|
|
const catcher1 = createCatcher({\\"click\\":0});
|
|
|
|
let block1 = createBlock(\`<div><span/><block-child-0/><p/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const hdlr1 = [ctx['increment'], ctx];
|
|
const b2 = catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on components, variation 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<button><block-text-0/></button>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].value;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on components, with 'prevent' modifier 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { createCatcher } = helpers;
|
|
const catcher1 = createCatcher({\\"click.prevent\\":0});
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const hdlr1 = [\\"prevent\\", ctx['increment'], ctx];
|
|
return catcher1(component(\`Child\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx), [hdlr1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on components, with 'prevent' modifier 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<button><block-text-0/></button>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let txt1 = ctx['props'].value;
|
|
return block1([txt1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on destroyed components 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2;
|
|
if (ctx['state'].flag) {
|
|
b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
|
}
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on destroyed components 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
|
|
let block1 = createBlock(\`<div block-handler-0=\\"click\\"/>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let hdlr1 = [ctx['onClick'], ctx];
|
|
return block1([hdlr1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on slot, with 'prevent' modifier 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
|
|
let block1 = createBlock(\`<button>button</button>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on slot, with 'prevent' modifier 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { callSlot, createCatcher } = helpers;
|
|
const catcher1 = createCatcher({\\"click.prevent\\":0});
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const hdlr1 = [\\"prevent\\", ctx['doSomething'], ctx];
|
|
return catcher1(callSlot(ctx, node, key, 'default', false, null), [hdlr1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on t-set-slots 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { capture, createCatcher, markRaw } = helpers;
|
|
const catcher1 = createCatcher({\\"click\\":0});
|
|
|
|
let block6 = createBlock(\`<p>something</p>\`);
|
|
let block7 = createBlock(\`<p>paragraph</p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
const b6 = block6();
|
|
const b7 = block7();
|
|
const hdlr1 = [()=>this.state.count++, ctx];
|
|
return catcher1(multi([b6, b7]), [hdlr1]);
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = text(\` [\`);
|
|
const b3 = text(ctx['state'].count);
|
|
const b4 = text(\`] \`);
|
|
const ctx1 = capture(ctx);
|
|
const b8 = component(\`Child\`, {slots: markRaw({'myslot': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx);
|
|
return multi([b2, b3, b4, b8]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on t-set-slots 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { callSlot } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return callSlot(ctx, node, key, 'myslot', false, null);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on t-slots 1`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { markRaw } = helpers;
|
|
|
|
let block1 = createBlock(\`<p>something</p>\`);
|
|
|
|
function slot1(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on on t-slots 2`] = `
|
|
"function anonymous(app, bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
|
let { callSlot, createCatcher } = helpers;
|
|
const catcher1 = createCatcher({\\"click\\":0});
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
const b2 = text(\` [\`);
|
|
const b3 = text(ctx['state'].count);
|
|
const b4 = text(\`] \`);
|
|
const hdlr1 = [()=>this.state.count++, ctx];
|
|
const b5 = catcher1(callSlot(ctx, node, key, 'default', false, null), [hdlr1]);
|
|
return multi([b2, b3, b4, b5]);
|
|
}
|
|
}"
|
|
`;
|