mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] move component function to app, improve some code
This commit is contained in:
committed by
Sam Degueldre
parent
51538c2fea
commit
0e6059467f
@@ -3,7 +3,7 @@
|
||||
exports[`hooks autofocus hook input in a t-if 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><block-child-0/></div>\`);
|
||||
let block2 = createBlock(\`<input block-ref=\\"0\\"/>\`);
|
||||
@@ -24,7 +24,7 @@ exports[`hooks autofocus hook input in a t-if 1`] = `
|
||||
exports[`hooks autofocus hook simple input 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><input block-ref=\\"1\\"/></div>\`);
|
||||
|
||||
@@ -40,10 +40,11 @@ exports[`hooks autofocus hook simple input 1`] = `
|
||||
exports[`hooks can use onWillStart, onWillUpdateProps 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`MyComponent\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return component(\`MyComponent\`, {value: ctx['state'].value}, key + \`__1\`, node, ctx);
|
||||
return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -51,7 +52,7 @@ exports[`hooks can use onWillStart, onWillUpdateProps 1`] = `
|
||||
exports[`hooks can use onWillStart, onWillUpdateProps 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||
|
||||
@@ -65,7 +66,7 @@ exports[`hooks can use onWillStart, onWillUpdateProps 2`] = `
|
||||
exports[`hooks can use useComponent 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div/>\`);
|
||||
|
||||
@@ -78,7 +79,7 @@ exports[`hooks can use useComponent 1`] = `
|
||||
exports[`hooks can use useEnv 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -92,7 +93,7 @@ exports[`hooks can use useEnv 1`] = `
|
||||
exports[`hooks mounted callbacks should be called in reverse order from willUnmount callbacks 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
||||
|
||||
@@ -106,11 +107,12 @@ exports[`hooks mounted callbacks should be called in reverse order from willUnmo
|
||||
exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const b2 = text(ctx['env'].val);
|
||||
const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
||||
const b3 = comp1({}, key + \`__1\`, node, ctx, null);
|
||||
return multi([b2, b3]);
|
||||
}
|
||||
}"
|
||||
@@ -119,7 +121,7 @@ exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 1`] = `
|
||||
exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block2 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -137,11 +139,12 @@ exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 2`] = `
|
||||
exports[`hooks parent and child env (with useChildSubEnv) 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const b2 = text(ctx['env'].val);
|
||||
const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
||||
const b3 = comp1({}, key + \`__1\`, node, ctx, null);
|
||||
return multi([b2, b3]);
|
||||
}
|
||||
}"
|
||||
@@ -150,7 +153,7 @@ exports[`hooks parent and child env (with useChildSubEnv) 1`] = `
|
||||
exports[`hooks parent and child env (with useChildSubEnv) 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -164,11 +167,12 @@ exports[`hooks parent and child env (with useChildSubEnv) 2`] = `
|
||||
exports[`hooks parent and child env (with useSubEnv) 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const b2 = text(ctx['env'].val);
|
||||
const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
||||
const b3 = comp1({}, key + \`__1\`, node, ctx, null);
|
||||
return multi([b2, b3]);
|
||||
}
|
||||
}"
|
||||
@@ -177,7 +181,7 @@ exports[`hooks parent and child env (with useSubEnv) 1`] = `
|
||||
exports[`hooks parent and child env (with useSubEnv) 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -191,7 +195,7 @@ exports[`hooks parent and child env (with useSubEnv) 2`] = `
|
||||
exports[`hooks two different call to willPatch/patched should work 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
||||
|
||||
@@ -205,7 +209,7 @@ exports[`hooks two different call to willPatch/patched should work 1`] = `
|
||||
exports[`hooks useChildSubEnv does not pollute user env 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -219,10 +223,11 @@ exports[`hooks useChildSubEnv does not pollute user env 1`] = `
|
||||
exports[`hooks useChildSubEnv supports arbitrary descriptor 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
||||
return comp1({}, key + \`__1\`, node, ctx, null);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -230,7 +235,7 @@ exports[`hooks useChildSubEnv supports arbitrary descriptor 1`] = `
|
||||
exports[`hooks useChildSubEnv supports arbitrary descriptor 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
||||
|
||||
@@ -245,7 +250,7 @@ exports[`hooks useChildSubEnv supports arbitrary descriptor 2`] = `
|
||||
exports[`hooks useEffect hook dependencies prevent effects from rerunning when unchanged 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div/>\`);
|
||||
|
||||
@@ -258,7 +263,7 @@ exports[`hooks useEffect hook dependencies prevent effects from rerunning when u
|
||||
exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
||||
|
||||
@@ -277,7 +282,7 @@ exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
|
||||
exports[`hooks useEffect hook effect runs on mount, is reapplied on patch, and is cleaned up on unmount and before reapplying 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div/>\`);
|
||||
|
||||
@@ -290,7 +295,7 @@ exports[`hooks useEffect hook effect runs on mount, is reapplied on patch, and i
|
||||
exports[`hooks useEffect hook effect with empty dependency list never reruns 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -304,7 +309,7 @@ exports[`hooks useEffect hook effect with empty dependency list never reruns 1`]
|
||||
exports[`hooks useEffect hook properly behaves when the effect function throws 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div/>\`);
|
||||
|
||||
@@ -317,12 +322,13 @@ exports[`hooks useEffect hook properly behaves when the effect function throws 1
|
||||
exports[`hooks useExternalListener 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`MyComponent\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2;
|
||||
if (ctx['state'].flag) {
|
||||
b2 = component(\`MyComponent\`, {}, key + \`__1\`, node, ctx);
|
||||
b2 = comp1({}, key + \`__1\`, node, ctx, null);
|
||||
}
|
||||
return multi([b2]);
|
||||
}
|
||||
@@ -332,7 +338,7 @@ exports[`hooks useExternalListener 1`] = `
|
||||
exports[`hooks useExternalListener 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||
|
||||
@@ -346,7 +352,7 @@ exports[`hooks useExternalListener 2`] = `
|
||||
exports[`hooks useRef hook: basic use 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><button block-ref=\\"0\\"><block-text-1/></button></div>\`);
|
||||
|
||||
@@ -362,7 +368,7 @@ exports[`hooks useRef hook: basic use 1`] = `
|
||||
exports[`hooks useSubEnv modifies user env 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||
|
||||
@@ -376,10 +382,11 @@ exports[`hooks useSubEnv modifies user env 1`] = `
|
||||
exports[`hooks useSubEnv supports arbitrary descriptor 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
||||
return comp1({}, key + \`__1\`, node, ctx, null);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -387,7 +394,7 @@ exports[`hooks useSubEnv supports arbitrary descriptor 1`] = `
|
||||
exports[`hooks useSubEnv supports arbitrary descriptor 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user