2021-10-21 10:13:08 +02:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
|
|
exports[`hooks autofocus hook input in a t-if 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><block-child-0/></div>\`);
|
|
|
|
|
let block2 = createBlock(\`<input block-ref=\\"0\\"/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const refs = ctx.__owl__.refs;
|
2021-12-22 08:52:51 +01:00
|
|
|
const ref1 = (el) => refs[\`input1\`] = el;
|
|
|
|
|
const ref2 = (el) => refs[\`input2\`] = el;
|
2021-10-21 10:13:08 +02:00
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].flag) {
|
2021-12-22 08:52:51 +01:00
|
|
|
b2 = block2([ref2]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
2021-12-22 08:52:51 +01:00
|
|
|
return block1([ref1], [b2]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks autofocus hook simple input 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><input block-ref=\\"1\\"/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const refs = ctx.__owl__.refs;
|
2021-12-22 08:52:51 +01:00
|
|
|
const ref1 = (el) => refs[\`input1\`] = el;
|
|
|
|
|
const ref2 = (el) => refs[\`input2\`] = el;
|
|
|
|
|
return block1([ref1, ref2]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks can use onWillStart, onWillUpdateProps 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`MyComponent\`, true, false, false, false);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks can use onWillStart, onWillUpdateProps 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
|
|
|
|
|
2021-10-21 10:13:08 +02:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].value;
|
|
|
|
|
return block1([txt1]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
exports[`hooks can use useComponent 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 14:53:40 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 14:53:40 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks can use useEnv 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 13:10:09 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 13:10:09 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['env'].val;
|
|
|
|
|
return block1([txt1]);
|
2021-11-15 13:10:09 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
exports[`hooks mounted callbacks should be called in reverse order from willUnmount callbacks 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['state'].value;
|
|
|
|
|
return block1([txt1]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-31 14:38:00 +01:00
|
|
|
exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-31 14:38:00 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2022-01-31 14:38:00 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = text(ctx['env'].val);
|
2022-06-22 15:39:31 +02:00
|
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
2022-01-31 14:38:00 +01:00
|
|
|
return multi([b2, b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-31 14:38:00 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-31 14:38:00 +01:00
|
|
|
|
|
|
|
|
let block2 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let b2;
|
|
|
|
|
if (ctx['env'].hasParent) {
|
|
|
|
|
let txt1 = ctx['env'].val;
|
|
|
|
|
b2 = block2([txt1]);
|
|
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-24 14:39:12 +01:00
|
|
|
exports[`hooks parent and child env (with useChildSubEnv) 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 13:10:09 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2021-11-15 13:10:09 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = text(ctx['env'].val);
|
2022-06-22 15:39:31 +02:00
|
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
return multi([b2, b3]);
|
2021-11-15 13:10:09 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-24 14:39:12 +01:00
|
|
|
exports[`hooks parent and child env (with useChildSubEnv) 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-24 14:39:12 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-24 14:39:12 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let txt1 = ctx['env'].val;
|
|
|
|
|
return block1([txt1]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks parent and child env (with useSubEnv) 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-24 14:39:12 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2022-01-24 14:39:12 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-03-06 10:27:07 +01:00
|
|
|
const b2 = text(ctx['env'].val);
|
2022-06-22 15:39:31 +02:00
|
|
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
2022-01-24 14:39:12 +01:00
|
|
|
return multi([b2, b3]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks parent and child env (with useSubEnv) 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 14:53:40 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 14:53:40 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['env'].val;
|
|
|
|
|
return block1([txt1]);
|
2021-11-15 14:53:40 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks two different call to willPatch/patched should work 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['state'].value;
|
|
|
|
|
return block1([txt1]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-24 14:39:12 +01:00
|
|
|
exports[`hooks useChildSubEnv does not pollute user env 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 13:10:09 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 13:10:09 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['env'].val;
|
|
|
|
|
return block1([txt1]);
|
2021-11-15 13:10:09 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-24 14:39:12 +01:00
|
|
|
exports[`hooks useChildSubEnv supports arbitrary descriptor 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-02 13:28:53 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2021-12-02 13:28:53 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2021-12-02 13:28:53 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-01-24 14:39:12 +01:00
|
|
|
exports[`hooks useChildSubEnv supports arbitrary descriptor 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-02 13:28:53 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-02 13:28:53 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
|
|
|
|
|
2021-12-02 13:28:53 +01:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['env'].someVal;
|
|
|
|
|
let txt2 = ctx['env'].someVal2;
|
|
|
|
|
return block1([txt1, txt2]);
|
2021-12-02 13:28:53 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
exports[`hooks useEffect hook dependencies prevent effects from rerunning when unchanged 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 13:10:09 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 13:10:09 +01:00
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
2021-11-15 13:10:09 +01:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-11-15 14:53:40 +01:00
|
|
|
return block1();
|
2021-11-15 13:10:09 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-12-21 16:36:36 +01:00
|
|
|
exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-12-21 16:36:36 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-12-21 16:36:36 +01:00
|
|
|
|
|
|
|
|
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const refs = ctx.__owl__.refs;
|
2021-12-22 08:52:51 +01:00
|
|
|
const ref1 = (el) => refs[\`div\`] = el;
|
2021-12-21 16:36:36 +01:00
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].value) {
|
2021-12-22 08:52:51 +01:00
|
|
|
b2 = block2([ref1]);
|
2021-12-21 16:36:36 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
exports[`hooks useEffect hook effect runs on mount, is reapplied on patch, and is cleaned up on unmount and before reapplying 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
2021-11-15 14:53:40 +01:00
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks useEffect hook effect with empty dependency list never reruns 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 14:53:40 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 14:53:40 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['state'].value;
|
|
|
|
|
return block1([txt1]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2022-03-08 15:16:58 +01:00
|
|
|
exports[`hooks useEffect hook properly behaves when the effect function throws 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-03-08 15:16:58 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-03-08 15:16:58 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div/>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
return block1();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-11-15 15:05:44 +01:00
|
|
|
exports[`hooks useExternalListener 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 15:05:44 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`MyComponent\`, true, false, false, true);
|
2021-11-15 15:05:44 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-20 11:19:59 +01:00
|
|
|
let b2;
|
|
|
|
|
if (ctx['state'].flag) {
|
2022-06-22 15:39:31 +02:00
|
|
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
2021-12-20 11:19:59 +01:00
|
|
|
}
|
|
|
|
|
return multi([b2]);
|
2021-11-15 15:05:44 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks useExternalListener 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-11-15 15:05:44 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-11-15 15:05:44 +01:00
|
|
|
|
2021-12-20 11:19:59 +01:00
|
|
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
|
|
|
|
|
2021-11-15 15:05:44 +01:00
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2021-12-22 11:33:12 +01:00
|
|
|
let txt1 = ctx['props'].value;
|
|
|
|
|
return block1([txt1]);
|
2021-11-15 15:05:44 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2021-10-21 10:13:08 +02:00
|
|
|
exports[`hooks useRef hook: basic use 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2021-10-21 10:13:08 +02:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2021-10-21 10:13:08 +02:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><button block-ref=\\"0\\"><block-text-1/></button></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
const refs = ctx.__owl__.refs;
|
2021-12-22 08:52:51 +01:00
|
|
|
const ref1 = (el) => refs[\`button\`] = el;
|
2021-12-22 12:33:17 +01:00
|
|
|
let txt1 = ctx['value'];
|
2021-12-22 08:52:51 +01:00
|
|
|
return block1([ref1, txt1]);
|
2021-10-21 10:13:08 +02:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
2022-01-24 14:39:12 +01:00
|
|
|
|
|
|
|
|
exports[`hooks useSubEnv modifies user env 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-24 14:39:12 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-24 14:39:12 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let txt1 = ctx['env'].val;
|
|
|
|
|
return block1([txt1]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks useSubEnv supports arbitrary descriptor 1`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-24 14:39:12 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-06-09 14:55:57 +02:00
|
|
|
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
2022-01-24 14:39:12 +01:00
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
2022-06-22 15:39:31 +02:00
|
|
|
return comp1({}, key + \`__1\`, node, this, null);
|
2022-01-24 14:39:12 +01:00
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`hooks useSubEnv supports arbitrary descriptor 2`] = `
|
2022-05-26 15:09:09 +02:00
|
|
|
"function anonymous(app, bdom, helpers
|
2022-01-24 14:39:12 +01:00
|
|
|
) {
|
2022-06-08 11:09:39 +02:00
|
|
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
2022-01-24 14:39:12 +01:00
|
|
|
|
|
|
|
|
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
|
|
|
|
|
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
|
|
|
let txt1 = ctx['env'].someVal;
|
|
|
|
|
let txt2 = ctx['env'].someVal2;
|
|
|
|
|
return block1([txt1, txt2]);
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
`;
|