mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
5cdaa7b473
closes #194
1973 lines
80 KiB
Plaintext
1973 lines
80 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`async rendering delayed component with t-asyncroot directive 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
if (!context['updateApp']) {
|
|
throw new Error('Missing handler \\\\'' + 'updateApp' + \`\\\\' when evaluating template 'Parent'\`)
|
|
}
|
|
extra.handlers['click' + 2] = extra.handlers['click' + 2] || context['updateApp'].bind(owner);
|
|
p2.on['click'] = extra.handlers['click' + 2];
|
|
c2.push({text: \`Update App State\`});
|
|
let _4 = {'children':true};
|
|
let c5 = [], p5 = {key:5,class:_4};
|
|
var vn5 = h('div', p5, c5);
|
|
c1.push(vn5);
|
|
//COMPONENT
|
|
let def7;
|
|
let w8 = 8 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[8]] : false;
|
|
let _6_index = c5.length;
|
|
c5.push(null);
|
|
let props8 = {val:context['state'].val};
|
|
if (w8 && w8.__owl__.currentFiber && !w8.__owl__.vnode) {
|
|
if (utils.shallowEqual(props8, w8.__owl__.currentFiber.props)) {
|
|
def7 = w8.__owl__.currentFiber.promise;
|
|
} else {
|
|
w8.destroy();
|
|
w8 = false;
|
|
}
|
|
}
|
|
if (!w8) {
|
|
let componentKey8 = \`Child\`;
|
|
let W8 = context.constructor.components[componentKey8] || QWeb.components[componentKey8]|| context['Child'];
|
|
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
|
|
w8 = new W8(parent, props8);
|
|
parent.__owl__.cmap[8] = w8.__owl__.id;
|
|
def7 = w8.__prepare(extra.fiber, undefined, undefined);
|
|
def7 = def7.then(vnode=>{if (w8.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 8, hook: {insert(vn) {let nvn=w8.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w8.destroy();}}});c5[_6_index]=pvnode;w8.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def7 = def7 || w8.__updateProps(props8, extra.fiber, undefined, undefined);
|
|
def7 = def7.then(()=>{if (w8.__owl__.isDestroyed) {return};let pvnode=w8.__owl__.pvnode;c5[_6_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def7);
|
|
//COMPONENT
|
|
let def10;
|
|
let w11 = 11 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[11]] : false;
|
|
let _9_index = c5.length;
|
|
const fiber11 = Object.assign(Object.create(extra.fiber), {patchQueue: []});
|
|
c5.push(w11 && w11.__owl__.pvnode || null);
|
|
let props11 = {val:context['state'].val};
|
|
if (w11 && w11.__owl__.currentFiber && !w11.__owl__.vnode) {
|
|
if (utils.shallowEqual(props11, w11.__owl__.currentFiber.props)) {
|
|
def10 = w11.__owl__.currentFiber.promise;
|
|
} else {
|
|
w11.destroy();
|
|
w11 = false;
|
|
}
|
|
}
|
|
if (!w11) {
|
|
let componentKey11 = \`AsyncChild\`;
|
|
let W11 = context.constructor.components[componentKey11] || QWeb.components[componentKey11]|| context['AsyncChild'];
|
|
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
|
|
w11 = new W11(parent, props11);
|
|
parent.__owl__.cmap[11] = w11.__owl__.id;
|
|
def10 = w11.__prepare(extra.fiber, undefined, undefined);
|
|
def10 = def10.then(vnode=>{if (w11.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 11, hook: {insert(vn) {let nvn=w11.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w11.destroy();}}});c5[_9_index]=pvnode;w11.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def10 = def10 || w11.__updateProps(props11, fiber11, undefined, undefined);
|
|
def10 = def10.then(()=>{if (w11.__owl__.isDestroyed) {return};let pvnode=w11.__owl__.pvnode;c5[_9_index]=pvnode;});
|
|
}
|
|
def10.then(w11.__applyPatchQueue.bind(w11, fiber11));
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`async rendering fast component with t-asyncroot directive 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
if (!context['updateApp']) {
|
|
throw new Error('Missing handler \\\\'' + 'updateApp' + \`\\\\' when evaluating template 'Parent'\`)
|
|
}
|
|
extra.handlers['click' + 2] = extra.handlers['click' + 2] || context['updateApp'].bind(owner);
|
|
p2.on['click'] = extra.handlers['click' + 2];
|
|
c2.push({text: \`Update App State\`});
|
|
let _4 = {'children':true};
|
|
let c5 = [], p5 = {key:5,class:_4};
|
|
var vn5 = h('div', p5, c5);
|
|
c1.push(vn5);
|
|
//COMPONENT
|
|
let def7;
|
|
let w8 = 8 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[8]] : false;
|
|
let _6_index = c5.length;
|
|
const fiber8 = Object.assign(Object.create(extra.fiber), {patchQueue: []});
|
|
c5.push(w8 && w8.__owl__.pvnode || null);
|
|
let props8 = {val:context['state'].val};
|
|
if (w8 && w8.__owl__.currentFiber && !w8.__owl__.vnode) {
|
|
if (utils.shallowEqual(props8, w8.__owl__.currentFiber.props)) {
|
|
def7 = w8.__owl__.currentFiber.promise;
|
|
} else {
|
|
w8.destroy();
|
|
w8 = false;
|
|
}
|
|
}
|
|
if (!w8) {
|
|
let componentKey8 = \`Child\`;
|
|
let W8 = context.constructor.components[componentKey8] || QWeb.components[componentKey8]|| context['Child'];
|
|
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
|
|
w8 = new W8(parent, props8);
|
|
parent.__owl__.cmap[8] = w8.__owl__.id;
|
|
def7 = w8.__prepare(extra.fiber, undefined, undefined);
|
|
def7 = def7.then(vnode=>{if (w8.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 8, hook: {insert(vn) {let nvn=w8.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w8.destroy();}}});c5[_6_index]=pvnode;w8.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def7 = def7 || w8.__updateProps(props8, fiber8, undefined, undefined);
|
|
def7 = def7.then(()=>{if (w8.__owl__.isDestroyed) {return};let pvnode=w8.__owl__.pvnode;c5[_6_index]=pvnode;});
|
|
}
|
|
def7.then(w8.__applyPatchQueue.bind(w8, fiber8));
|
|
//COMPONENT
|
|
let def10;
|
|
let w11 = 11 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[11]] : false;
|
|
let _9_index = c5.length;
|
|
c5.push(null);
|
|
let props11 = {val:context['state'].val};
|
|
if (w11 && w11.__owl__.currentFiber && !w11.__owl__.vnode) {
|
|
if (utils.shallowEqual(props11, w11.__owl__.currentFiber.props)) {
|
|
def10 = w11.__owl__.currentFiber.promise;
|
|
} else {
|
|
w11.destroy();
|
|
w11 = false;
|
|
}
|
|
}
|
|
if (!w11) {
|
|
let componentKey11 = \`AsyncChild\`;
|
|
let W11 = context.constructor.components[componentKey11] || QWeb.components[componentKey11]|| context['AsyncChild'];
|
|
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
|
|
w11 = new W11(parent, props11);
|
|
parent.__owl__.cmap[11] = w11.__owl__.id;
|
|
def10 = w11.__prepare(extra.fiber, undefined, undefined);
|
|
def10 = def10.then(vnode=>{if (w11.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 11, hook: {insert(vn) {let nvn=w11.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w11.destroy();}}});c5[_9_index]=pvnode;w11.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def10 = def10 || w11.__updateProps(props11, extra.fiber, undefined, undefined);
|
|
def10 = def10.then(()=>{if (w11.__owl__.isDestroyed) {return};let pvnode=w11.__owl__.pvnode;c5[_9_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def10);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`async rendering t-component with t-asyncroot directive: mixed re-renderings 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
if (!context['updateApp']) {
|
|
throw new Error('Missing handler \\\\'' + 'updateApp' + \`\\\\' when evaluating template 'Parent'\`)
|
|
}
|
|
extra.handlers['click' + 2] = extra.handlers['click' + 2] || context['updateApp'].bind(owner);
|
|
p2.on['click'] = extra.handlers['click' + 2];
|
|
c2.push({text: \`Update App State\`});
|
|
let _4 = {'children':true};
|
|
let c5 = [], p5 = {key:5,class:_4};
|
|
var vn5 = h('div', p5, c5);
|
|
c1.push(vn5);
|
|
//COMPONENT
|
|
let def7;
|
|
let w8 = 8 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[8]] : false;
|
|
let _6_index = c5.length;
|
|
c5.push(null);
|
|
let props8 = {val:context['state'].val};
|
|
if (w8 && w8.__owl__.currentFiber && !w8.__owl__.vnode) {
|
|
if (utils.shallowEqual(props8, w8.__owl__.currentFiber.props)) {
|
|
def7 = w8.__owl__.currentFiber.promise;
|
|
} else {
|
|
w8.destroy();
|
|
w8 = false;
|
|
}
|
|
}
|
|
if (!w8) {
|
|
let componentKey8 = \`Child\`;
|
|
let W8 = context.constructor.components[componentKey8] || QWeb.components[componentKey8]|| context['Child'];
|
|
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
|
|
w8 = new W8(parent, props8);
|
|
parent.__owl__.cmap[8] = w8.__owl__.id;
|
|
def7 = w8.__prepare(extra.fiber, undefined, undefined);
|
|
def7 = def7.then(vnode=>{if (w8.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 8, hook: {insert(vn) {let nvn=w8.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w8.destroy();}}});c5[_6_index]=pvnode;w8.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def7 = def7 || w8.__updateProps(props8, extra.fiber, undefined, undefined);
|
|
def7 = def7.then(()=>{if (w8.__owl__.isDestroyed) {return};let pvnode=w8.__owl__.pvnode;c5[_6_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def7);
|
|
//COMPONENT
|
|
let def10;
|
|
let w11 = 11 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[11]] : false;
|
|
let _9_index = c5.length;
|
|
const fiber11 = Object.assign(Object.create(extra.fiber), {patchQueue: []});
|
|
c5.push(w11 && w11.__owl__.pvnode || null);
|
|
let props11 = {val:context['state'].val};
|
|
if (w11 && w11.__owl__.currentFiber && !w11.__owl__.vnode) {
|
|
if (utils.shallowEqual(props11, w11.__owl__.currentFiber.props)) {
|
|
def10 = w11.__owl__.currentFiber.promise;
|
|
} else {
|
|
w11.destroy();
|
|
w11 = false;
|
|
}
|
|
}
|
|
if (!w11) {
|
|
let componentKey11 = \`AsyncChild\`;
|
|
let W11 = context.constructor.components[componentKey11] || QWeb.components[componentKey11]|| context['AsyncChild'];
|
|
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
|
|
w11 = new W11(parent, props11);
|
|
parent.__owl__.cmap[11] = w11.__owl__.id;
|
|
def10 = w11.__prepare(extra.fiber, undefined, undefined);
|
|
def10 = def10.then(vnode=>{if (w11.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 11, hook: {insert(vn) {let nvn=w11.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w11.destroy();}}});c5[_9_index]=pvnode;w11.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def10 = def10 || w11.__updateProps(props11, fiber11, undefined, undefined);
|
|
def10 = def10.then(()=>{if (w11.__owl__.isDestroyed) {return};let pvnode=w11.__owl__.pvnode;c5[_9_index]=pvnode;});
|
|
}
|
|
def10.then(w11.__applyPatchQueue.bind(w11, fiber11));
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`class and style attributes with t-component dynamic t-att-style is properly added and updated on widget root el 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
const _5 = context['state'].style;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.style = _5;}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};w4.el.style=_5;let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v2) 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
const ref5 = \`child\`;
|
|
let _6 = {'a':true};
|
|
Object.assign(_6, {b:context['state'].b})
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`Child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['Child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;context.__owl__.refs[ref5] = w4;},remove() {},destroy(vn) {w4.destroy();delete context.__owl__.refs[ref5];}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
w4.__owl__.classObj=_6;
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v2) 2`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
var h = this.h;
|
|
let _2 = {'c':true};
|
|
Object.assign(_2, utils.toObj({d:context['state'].d}))
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
var vn3 = h('span', p3, c3);
|
|
result = vn3;
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v3) 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
const ref5 = \`child\`;
|
|
let _6 = {'a':true};
|
|
Object.assign(_6, utils.toObj(context['state'].b?'b':''))
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`Child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['Child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;context.__owl__.refs[ref5] = w4;},remove() {},destroy(vn) {w4.destroy();delete context.__owl__.refs[ref5];}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
w4.__owl__.classObj=_6;
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v3) 2`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
var h = this.h;
|
|
let _2 = {'c':true};
|
|
Object.assign(_2, utils.toObj(context['state'].d?'d':''))
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
var vn3 = h('span', p3, c3);
|
|
result = vn3;
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let _5 = {a:context['state'].a,b:context['state'].b};
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
w4.__owl__.classObj=_5;
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition sub components dom state with t-keepalive is preserved 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
if (context['state'].ok) {
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
const fiber4 = Object.assign(Object.create(extra.fiber), {patchQueue: []});
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`InputWidget\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['InputWidget'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.unmount();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, w4.__owl__.isMounted ? extra.fiber : fiber4, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;pvnode.data.hook.insert = vn => {vn.elm.parentNode.replaceChild(w4.el,vn.elm);vn.elm=w4.el;w4.__remount();};c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition sub components with some state rendered in a loop 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
context = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
var _2 = context['state'].numbers;
|
|
if (!_2) { throw new Error('QWeb error: Invalid loop expression')}
|
|
var _3 = _4 = _2;
|
|
if (!(_2 instanceof Array)) {
|
|
_3 = Object.keys(_2);
|
|
_4 = Object.values(_2);
|
|
}
|
|
var _length3 = _3.length;
|
|
for (let i = 0; i < _length3; i++) {
|
|
context.number_first = i === 0;
|
|
context.number_last = i === _length3 - 1;
|
|
context.number_index = i;
|
|
context.number = _3[i];
|
|
context.number_value = _4[i];
|
|
//COMPONENT
|
|
let key8 = 'key' + context['number'];
|
|
let def6;
|
|
let templateId9 = key8;
|
|
let w7 = templateId9 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId9]] : false;
|
|
let _5_index = c1.length;
|
|
c1.push(null);
|
|
let props7 = {};
|
|
if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) {
|
|
if (utils.shallowEqual(props7, w7.__owl__.currentFiber.props)) {
|
|
def6 = w7.__owl__.currentFiber.promise;
|
|
} else {
|
|
w7.destroy();
|
|
w7 = false;
|
|
}
|
|
}
|
|
if (!w7) {
|
|
let componentKey7 = \`ChildWidget\`;
|
|
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7]|| context['ChildWidget'];
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
|
w7 = new W7(parent, props7);
|
|
parent.__owl__.cmap[templateId9] = w7.__owl__.id;
|
|
def6 = w7.__prepare(extra.fiber, undefined, undefined);
|
|
def6 = def6.then(vnode=>{if (w7.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: templateId9, hook: {insert(vn) {let nvn=w7.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w7.destroy();}}});c1[_5_index]=pvnode;w7.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def6 = def6 || w7.__updateProps(props7, extra.fiber, undefined, undefined);
|
|
def6 = def6.then(()=>{if (w7.__owl__.isDestroyed) {return};let pvnode=w7.__owl__.pvnode;c1[_5_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def6);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition t-component with dynamic value 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = (context['state'].widget);
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition t-component with dynamic value 2 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`Widget\${context['state'].widget}\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`dynamic t-props basic use 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = Object.assign({}, context['some'].obj);
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`Child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['Child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`lifecycle hooks willPatch/patched hook with t-keepalive 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
if (context['state'].flag) {
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
const fiber4 = Object.assign(Object.create(extra.fiber), {patchQueue: []});
|
|
c1.push(null);
|
|
let props4 = {v:context['state'].n};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`ChildWidget\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['ChildWidget'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.unmount();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, w4.__owl__.isMounted ? extra.fiber : fiber4, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;pvnode.data.hook.insert = vn => {vn.elm.parentNode.replaceChild(w4.el,vn.elm);vn.elm=w4.el;w4.__remount();};c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to argument 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, 3));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to empty object (with non empty inner string) 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, {}));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to empty object 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, {}));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to object 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, {val:3}));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with prevent and self modifiers (order matters) 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`Child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['Child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {e.preventDefault();if (e.target !== vn.elm) {return}owner['onEv'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with self and prevent modifiers (order matters) 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (e.target !== vn.elm) {return}e.preventDefault();owner['onEv'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with self modifier 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev-1', owner['onEv1'].bind(owner));vn.elm.addEventListener('ev-2', function (e) {if (e.target !== vn.elm) {return}owner['onEv2'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with stop and/or prevent modifiers 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev-1', function (e) {e.stopPropagation();owner['onEv1'].call(owner, e);});vn.elm.addEventListener('ev-2', function (e) {e.preventDefault();owner['onEv2'].call(owner, e);});vn.elm.addEventListener('ev-3', function (e) {e.stopPropagation();e.preventDefault();owner['onEv3'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`random stuff/miscellaneous can inject values in tagged templates 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2};
|
|
var vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
var _3 = context['state'].n;
|
|
if (_3 || _3 === 0) {
|
|
c2.push({text: _3});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`random stuff/miscellaneous snapshotting compiled code 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let key5 = 'key' + 'somestring';
|
|
let def3;
|
|
let templateId6 = key5;
|
|
let w4 = templateId6 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId6]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {flag:context['state'].flag};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`child\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['child'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[templateId6] = w4.__owl__.id;
|
|
def3 = w4.__prepare(extra.fiber, undefined, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: templateId6, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, undefined, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`random stuff/miscellaneous t-on with handler bound to dynamic argument on a t-foreach 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
context = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
var _2 = context['props'].items;
|
|
if (!_2) { throw new Error('QWeb error: Invalid loop expression')}
|
|
var _3 = _4 = _2;
|
|
if (!(_2 instanceof Array)) {
|
|
_3 = Object.keys(_2);
|
|
_4 = Object.values(_2);
|
|
}
|
|
var _length3 = _3.length;
|
|
for (let i = 0; i < _length3; i++) {
|
|
context.item_first = i === 0;
|
|
context.item_last = i === _length3 - 1;
|
|
context.item_index = i;
|
|
context.item = _3[i];
|
|
context.item_value = _4[i];
|
|
//COMPONENT
|
|
let key8 = 'key' + context['item'];
|
|
let def6;
|
|
let templateId9 = key8;
|
|
let arg10 = context['item'];
|
|
let w7 = templateId9 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId9]] : false;
|
|
let _5_index = c1.length;
|
|
c1.push(null);
|
|
let props7 = {};
|
|
if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) {
|
|
if (utils.shallowEqual(props7, w7.__owl__.currentFiber.props)) {
|
|
def6 = w7.__owl__.currentFiber.promise;
|
|
} else {
|
|
w7.destroy();
|
|
w7 = false;
|
|
}
|
|
}
|
|
if (!w7) {
|
|
let componentKey7 = \`Child\`;
|
|
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7]|| context['Child'];
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
|
w7 = new W7(parent, props7);
|
|
parent.__owl__.cmap[templateId9] = w7.__owl__.id;
|
|
def6 = w7.__prepare(extra.fiber, undefined, undefined);
|
|
def6 = def6.then(vnode=>{if (w7.__owl__.isDestroyed){return}vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, arg10));}};let pvnode=h(vnode.sel, {key: templateId9, hook: {insert(vn) {let nvn=w7.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w7.destroy();}}});c1[_5_index]=pvnode;w7.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def6 = def6 || w7.__updateProps(props7, extra.fiber, undefined, undefined);
|
|
def6 = def6.then(()=>{if (w7.__owl__.isDestroyed) {return};let pvnode=w7.__owl__.pvnode;c1[_5_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def6);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive .lazy modifier 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
p2.props = {value: context['state'].text};
|
|
extra.handlers['change' + 2] = extra.handlers['change' + 2] || ((ev) => {context['state'].text = ev.target.value});
|
|
p2.on['change'] = extra.handlers['change' + 2];
|
|
let c3 = [], p3 = {key:3};
|
|
var vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
var _4 = context['state'].text;
|
|
if (_4 || _4 === 0) {
|
|
c3.push({text: _4});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive basic use, on an input 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
p2.props = {value: context['state'].text};
|
|
extra.handlers['input' + 2] = extra.handlers['input' + 2] || ((ev) => {context['state'].text = ev.target.value});
|
|
p2.on['input'] = extra.handlers['input' + 2];
|
|
let c3 = [], p3 = {key:3};
|
|
var vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
var _4 = context['state'].text;
|
|
if (_4 || _4 === 0) {
|
|
c3.push({text: _4});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive basic use, on another key in component 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
p2.props = {value: context['some'].text};
|
|
extra.handlers['input' + 2] = extra.handlers['input' + 2] || ((ev) => {context['some'].text = ev.target.value});
|
|
p2.on['input'] = extra.handlers['input' + 2];
|
|
let c3 = [], p3 = {key:3};
|
|
var vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
var _4 = context['some'].text;
|
|
if (_4 || _4 === 0) {
|
|
c3.push({text: _4});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on a select 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('select', p2, c2);
|
|
c1.push(vn2);
|
|
p2.props = {value: context['state'].color};
|
|
extra.handlers['change' + 2] = extra.handlers['change' + 2] || ((ev) => {context['state'].color = ev.target.value});
|
|
p2.on['change'] = extra.handlers['change' + 2];
|
|
p2.hook = {
|
|
create: (_, n) => {
|
|
n.elm.value=context['state'].color;
|
|
},
|
|
};
|
|
var _3 = '';
|
|
let c4 = [], p4 = {key:4,attrs:{value: _3}};
|
|
var vn4 = h('option', p4, c4);
|
|
c2.push(vn4);
|
|
c4.push({text: \`Please select one\`});
|
|
var _5 = 'red';
|
|
let c6 = [], p6 = {key:6,attrs:{value: _5}};
|
|
var vn6 = h('option', p6, c6);
|
|
c2.push(vn6);
|
|
c6.push({text: \`Red\`});
|
|
var _7 = 'blue';
|
|
let c8 = [], p8 = {key:8,attrs:{value: _7}};
|
|
var vn8 = h('option', p8, c8);
|
|
c2.push(vn8);
|
|
c8.push({text: \`Blue\`});
|
|
let c9 = [], p9 = {key:9};
|
|
var vn9 = h('span', p9, c9);
|
|
c1.push(vn9);
|
|
c9.push({text: \`Choice: \`});
|
|
var _10 = context['state'].color;
|
|
if (_10 || _10 === 0) {
|
|
c9.push({text: _10});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on a sub state key 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
p2.props = {value: context['state'].something.text};
|
|
extra.handlers['input' + 2] = extra.handlers['input' + 2] || ((ev) => {context['state'].something.text = ev.target.value});
|
|
p2.on['input'] = extra.handlers['input' + 2];
|
|
let c3 = [], p3 = {key:3};
|
|
var vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
var _4 = context['state'].something.text;
|
|
if (_4 || _4 === 0) {
|
|
c3.push({text: _4});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on an input type=radio 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
var _2 = 'radio';
|
|
var _3 = 'one';
|
|
var _4 = 'One';
|
|
let c5 = [], p5 = {key:5,attrs:{type: _2,id: _3,value: _4},on:{}};
|
|
var vn5 = h('input', p5, c5);
|
|
c1.push(vn5);
|
|
p5.props = {checked:context['state'].choice === 'One'};
|
|
extra.handlers['click' + 5] = extra.handlers['click' + 5] || ((ev) => {context['state'].choice = ev.target.value});
|
|
p5.on['click'] = extra.handlers['click' + 5];
|
|
var _6 = 'radio';
|
|
var _7 = 'two';
|
|
var _8 = 'Two';
|
|
let c9 = [], p9 = {key:9,attrs:{type: _6,id: _7,value: _8},on:{}};
|
|
var vn9 = h('input', p9, c9);
|
|
c1.push(vn9);
|
|
p9.props = {checked:context['state'].choice === 'Two'};
|
|
extra.handlers['click' + 9] = extra.handlers['click' + 9] || ((ev) => {context['state'].choice = ev.target.value});
|
|
p9.on['click'] = extra.handlers['click' + 9];
|
|
let c10 = [], p10 = {key:10};
|
|
var vn10 = h('span', p10, c10);
|
|
c1.push(vn10);
|
|
c10.push({text: \`Choice: \`});
|
|
var _11 = context['state'].choice;
|
|
if (_11 || _11 === 0) {
|
|
c10.push({text: _11});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on an input, type=checkbox 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
var _2 = 'checkbox';
|
|
let c3 = [], p3 = {key:3,attrs:{type: _2},on:{}};
|
|
var vn3 = h('input', p3, c3);
|
|
c1.push(vn3);
|
|
p3.props = {checked: context['state'].flag};
|
|
extra.handlers['input' + 3] = extra.handlers['input' + 3] || ((ev) => {context['state'].flag = ev.target.checked});
|
|
p3.on['input'] = extra.handlers['input' + 3];
|
|
let c4 = [], p4 = {key:4};
|
|
var vn4 = h('span', p4, c4);
|
|
c1.push(vn4);
|
|
if (context['state'].flag) {
|
|
c4.push({text: \`yes\`});
|
|
}
|
|
else {
|
|
c4.push({text: \`no\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
//COMPONENT
|
|
let def3;
|
|
let w4 = 4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[4]] : false;
|
|
let _2_index = c1.length;
|
|
c1.push(null);
|
|
let props4 = {};
|
|
if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) {
|
|
if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) {
|
|
def3 = w4.__owl__.currentFiber.promise;
|
|
} else {
|
|
w4.destroy();
|
|
w4 = false;
|
|
}
|
|
}
|
|
if (!w4) {
|
|
let componentKey4 = \`Dialog\`;
|
|
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| context['Dialog'];
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
w4 = new W4(parent, props4);
|
|
parent.__owl__.cmap[4] = w4.__owl__.id;
|
|
w4.__owl__.slotId = 1;
|
|
def3 = w4.__prepare(extra.fiber, {}, undefined);
|
|
def3 = def3.then(vnode=>{if (w4.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def3 = def3 || w4.__updateProps(props4, extra.fiber, {}, undefined);
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 2`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2};
|
|
var vn2 = h('div', p2, c2);
|
|
c1.push(vn2);
|
|
const slot3 = this.constructor.slots[context.__owl__.slotId + '_' + 'header'];
|
|
if (slot3) {
|
|
slot3.call(this, context.__owl__.parent, Object.assign({}, extra, {parentNode: c2, vars: extra.vars, parent: owner}));
|
|
}
|
|
let c4 = [], p4 = {key:4};
|
|
var vn4 = h('div', p4, c4);
|
|
c1.push(vn4);
|
|
const slot5 = this.constructor.slots[context.__owl__.slotId + '_' + 'footer'];
|
|
if (slot5) {
|
|
slot5.call(this, context.__owl__.parent, Object.assign({}, extra, {parentNode: c4, vars: extra.vars, parent: owner}));
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 3`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`header\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 4`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`footer\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive content is the default slot 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`sts rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive default slot work with text nodes 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
c1.push({text: \`sts rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive multiple roots are allowed in a default slot 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`sts\`});
|
|
let c7 = [], p7 = {key:7};
|
|
var vn7 = h('span', p7, c7);
|
|
c1.push(vn7);
|
|
c7.push({text: \`rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive multiple roots are allowed in a named slot 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`sts\`});
|
|
let c7 = [], p7 = {key:7};
|
|
var vn7 = h('span', p7, c7);
|
|
c1.push(vn7);
|
|
c7.push({text: \`rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive refs are properly bound in slots 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let owner = context;
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c10 = [], p10 = {key:10,on:{}};
|
|
var vn10 = h('button', p10, c10);
|
|
c1.push(vn10);
|
|
if (!context['doSomething']) {
|
|
throw new Error('Missing handler \\\\'' + 'doSomething' + \`\\\\' when evaluating template 'slot_footer_template'\`)
|
|
}
|
|
extra.handlers['click' + 10] = extra.handlers['click' + 10] || context['doSomething'].bind(owner);
|
|
p10.on['click'] = extra.handlers['click' + 10];
|
|
const ref11 = \`myButton\`;
|
|
p10.hook = {
|
|
create: (_, n) => {
|
|
context.__owl__.refs[ref11] = n.elm;
|
|
},
|
|
};
|
|
c10.push({text: \`do something\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
let c10 = [], p10 = {key:10,on:{}};
|
|
var vn10 = h('button', p10, c10);
|
|
c1.push(vn10);
|
|
if (!context['doSomething']) {
|
|
throw new Error('Missing handler \\\\'' + 'doSomething' + \`\\\\' when evaluating template 'slot_footer_template'\`)
|
|
}
|
|
extra.handlers['click' + 10] = extra.handlers['click' + 10] || context['doSomething'].bind(owner);
|
|
p10.on['click'] = extra.handlers['click' + 10];
|
|
c10.push({text: \`do something\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let owner = context;
|
|
var h = this.h;
|
|
var _1 = context['props'].to;
|
|
let c2 = [], p2 = {key:2,attrs:{href: _1}};
|
|
var vn2 = h('a', p2, c2);
|
|
result = vn2;
|
|
const slot3 = this.constructor.slots[context.__owl__.slotId + '_' + 'default'];
|
|
if (slot3) {
|
|
slot3.call(this, context.__owl__.parent, Object.assign({}, extra, {parentNode: c2, vars: extra.vars, parent: owner}));
|
|
}
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 2`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
context = Object.create(context);
|
|
const scope = Object.create(null);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2};
|
|
var vn2 = h('u', p2, c2);
|
|
c1.push(vn2);
|
|
var _3 = context['state'].users;
|
|
if (!_3) { throw new Error('QWeb error: Invalid loop expression')}
|
|
var _4 = _5 = _3;
|
|
if (!(_3 instanceof Array)) {
|
|
_4 = Object.keys(_3);
|
|
_5 = Object.values(_3);
|
|
}
|
|
var _length4 = _4.length;
|
|
for (let i = 0; i < _length4; i++) {
|
|
context.user_first = i === 0;
|
|
scope.user_first = context.user_first;
|
|
context.user_last = i === _length4 - 1;
|
|
scope.user_last = context.user_last;
|
|
context.user_index = i;
|
|
scope.user_index = context.user_index;
|
|
context.user = _4[i];
|
|
scope.user = context.user;
|
|
context.user_value = _5[i];
|
|
scope.user_value = context.user_value;
|
|
const nodeKey6 = context['user'].id
|
|
let c6 = [], p6 = {key:nodeKey6};
|
|
var vn6 = h('li', p6, c6);
|
|
c2.push(vn6);
|
|
//COMPONENT
|
|
let def8;
|
|
let templateId10 = String(nodeKey6 + '_k_' + i + '_c_' + 9 );
|
|
let w9 = templateId10 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId10]] : false;
|
|
let _7_index = c6.length;
|
|
c6.push(null);
|
|
let props9 = {to:'/user/'+context['user'].id};
|
|
if (w9 && w9.__owl__.currentFiber && !w9.__owl__.vnode) {
|
|
if (utils.shallowEqual(props9, w9.__owl__.currentFiber.props)) {
|
|
def8 = w9.__owl__.currentFiber.promise;
|
|
} else {
|
|
w9.destroy();
|
|
w9 = false;
|
|
}
|
|
}
|
|
if (!w9) {
|
|
let componentKey9 = \`Link\`;
|
|
let W9 = context.constructor.components[componentKey9] || QWeb.components[componentKey9]|| context['Link'];
|
|
if (!W9) {throw new Error('Cannot find the definition of component \\"' + componentKey9 + '\\"')}
|
|
w9 = new W9(parent, props9);
|
|
parent.__owl__.cmap[templateId10] = w9.__owl__.id;
|
|
w9.__owl__.slotId = 1;
|
|
def8 = w9.__prepare(extra.fiber, Object.assign({}, scope), undefined);
|
|
def8 = def8.then(vnode=>{if (w9.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: templateId10, hook: {insert(vn) {let nvn=w9.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w9.destroy();}}});c6[_7_index]=pvnode;w9.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def8 = def8 || w9.__updateProps(props9, extra.fiber, Object.assign({}, scope), undefined);
|
|
def8 = def8.then(()=>{if (w9.__owl__.isDestroyed) {return};let pvnode=w9.__owl__.pvnode;c6[_7_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def8);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 3`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c6 = extra.parentNode;
|
|
Object.assign(context, extra.fiber.scope);
|
|
c6.push({text: \`User \`});
|
|
var _12 = context['user'].name;
|
|
if (_12 || _12 === 0) {
|
|
c6.push({text: _12});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let owner = context;
|
|
var h = this.h;
|
|
var _1 = context['props'].to;
|
|
let c2 = [], p2 = {key:2,attrs:{href: _1}};
|
|
var vn2 = h('a', p2, c2);
|
|
result = vn2;
|
|
const slot3 = this.constructor.slots[context.__owl__.slotId + '_' + 'default'];
|
|
if (slot3) {
|
|
slot3.call(this, context.__owl__.parent, Object.assign({}, extra, {parentNode: c2, vars: extra.vars, parent: owner}));
|
|
}
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 2`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
context = Object.create(context);
|
|
const scope = Object.create(null);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
let c2 = [], p2 = {key:2};
|
|
var vn2 = h('u', p2, c2);
|
|
c1.push(vn2);
|
|
var _3 = context['state'].users;
|
|
if (!_3) { throw new Error('QWeb error: Invalid loop expression')}
|
|
var _4 = _5 = _3;
|
|
if (!(_3 instanceof Array)) {
|
|
_4 = Object.keys(_3);
|
|
_5 = Object.values(_3);
|
|
}
|
|
var _length4 = _4.length;
|
|
for (let i = 0; i < _length4; i++) {
|
|
context.user_first = i === 0;
|
|
scope.user_first = context.user_first;
|
|
context.user_last = i === _length4 - 1;
|
|
scope.user_last = context.user_last;
|
|
context.user_index = i;
|
|
scope.user_index = context.user_index;
|
|
context.user = _4[i];
|
|
scope.user = context.user;
|
|
context.user_value = _5[i];
|
|
scope.user_value = context.user_value;
|
|
const nodeKey6 = context['user'].id
|
|
let c6 = [], p6 = {key:nodeKey6};
|
|
var vn6 = h('li', p6, c6);
|
|
c2.push(vn6);
|
|
var _7 = 'User '+context['user'].name;
|
|
//COMPONENT
|
|
let def9;
|
|
let templateId11 = String(nodeKey6 + '_k_' + i + '_c_' + 10 );
|
|
let w10 = templateId11 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId11]] : false;
|
|
let _8_index = c6.length;
|
|
c6.push(null);
|
|
let props10 = {to:'/user/'+context['user'].id};
|
|
if (w10 && w10.__owl__.currentFiber && !w10.__owl__.vnode) {
|
|
if (utils.shallowEqual(props10, w10.__owl__.currentFiber.props)) {
|
|
def9 = w10.__owl__.currentFiber.promise;
|
|
} else {
|
|
w10.destroy();
|
|
w10 = false;
|
|
}
|
|
}
|
|
if (!w10) {
|
|
let componentKey10 = \`Link\`;
|
|
let W10 = context.constructor.components[componentKey10] || QWeb.components[componentKey10]|| context['Link'];
|
|
if (!W10) {throw new Error('Cannot find the definition of component \\"' + componentKey10 + '\\"')}
|
|
w10 = new W10(parent, props10);
|
|
parent.__owl__.cmap[templateId11] = w10.__owl__.id;
|
|
w10.__owl__.slotId = 1;
|
|
def9 = w10.__prepare(extra.fiber, Object.assign({}, scope), {_7});
|
|
def9 = def9.then(vnode=>{if (w10.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: templateId11, hook: {insert(vn) {let nvn=w10.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w10.destroy();}}});c6[_8_index]=pvnode;w10.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def9 = def9 || w10.__updateProps(props10, extra.fiber, Object.assign({}, scope), {_7});
|
|
def9 = def9.then(()=>{if (w10.__owl__.isDestroyed) {return};let pvnode=w10.__owl__.pvnode;c6[_8_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def9);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 3`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c6 = extra.parentNode;
|
|
let _7 = extra.fiber.vars._7
|
|
Object.assign(context, extra.fiber.scope);
|
|
if (_7 || _7 === 0) {
|
|
c6.push({text: _7});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 4 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
var _2 = 'User '+context['state'].user.name;
|
|
//COMPONENT
|
|
let def4;
|
|
let w5 = 5 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[5]] : false;
|
|
let _3_index = c1.length;
|
|
c1.push(null);
|
|
let props5 = {to:'/user/'+context['state'].user.id};
|
|
if (w5 && w5.__owl__.currentFiber && !w5.__owl__.vnode) {
|
|
if (utils.shallowEqual(props5, w5.__owl__.currentFiber.props)) {
|
|
def4 = w5.__owl__.currentFiber.promise;
|
|
} else {
|
|
w5.destroy();
|
|
w5 = false;
|
|
}
|
|
}
|
|
if (!w5) {
|
|
let componentKey5 = \`Link\`;
|
|
let W5 = context.constructor.components[componentKey5] || QWeb.components[componentKey5]|| context['Link'];
|
|
if (!W5) {throw new Error('Cannot find the definition of component \\"' + componentKey5 + '\\"')}
|
|
w5 = new W5(parent, props5);
|
|
parent.__owl__.cmap[5] = w5.__owl__.id;
|
|
w5.__owl__.slotId = 1;
|
|
def4 = w5.__prepare(extra.fiber, {}, {_2});
|
|
def4 = def4.then(vnode=>{if (w5.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 5, hook: {insert(vn) {let nvn=w5.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w5.destroy();}}});c1[_3_index]=pvnode;w5.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def4 = def4 || w5.__updateProps(props5, extra.fiber, {}, {_2});
|
|
def4 = def4.then(()=>{if (w5.__owl__.isDestroyed) {return};let pvnode=w5.__owl__.pvnode;c1[_3_index]=pvnode;});
|
|
}
|
|
extra.promises.push(def4);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 4 2`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let _2 = extra.fiber.vars._2
|
|
Object.assign(context, extra.fiber.scope);
|
|
if (_2 || _2 === 0) {
|
|
c1.push({text: _2});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`top level sub widgets basic use 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
let result;
|
|
var h = this.h;
|
|
//COMPONENT
|
|
let def2;
|
|
let w3 = 3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[3]] : false;
|
|
let vn4 = {};
|
|
result = vn4;
|
|
let props3 = {p:1};
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
if (utils.shallowEqual(props3, w3.__owl__.currentFiber.props)) {
|
|
def2 = w3.__owl__.currentFiber.promise;
|
|
} else {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
}
|
|
if (!w3) {
|
|
let componentKey3 = \`Child\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| context['Child'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[3] = w3.__owl__.id;
|
|
def2 = w3.__prepare(extra.fiber, undefined, undefined);
|
|
def2 = def2.then(vnode=>{if (w3.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 3, hook: {insert(vn) {let nvn=w3.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w3.destroy();}}});utils.defineProxy(vn4, pvnode);w3.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def2 = def2 || w3.__updateProps(props3, extra.fiber, undefined, undefined);
|
|
def2 = def2.then(()=>{if (w3.__owl__.isDestroyed) {return};let pvnode=w3.__owl__.pvnode;utils.defineProxy(vn4, pvnode);});
|
|
}
|
|
extra.promises.push(def2);
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`top level sub widgets can select a sub widget 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
let result;
|
|
var h = this.h;
|
|
if (context['env'].flag) {
|
|
//COMPONENT
|
|
let def2;
|
|
let w3 = 3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[3]] : false;
|
|
let vn4 = {};
|
|
result = vn4;
|
|
let props3 = {};
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
if (utils.shallowEqual(props3, w3.__owl__.currentFiber.props)) {
|
|
def2 = w3.__owl__.currentFiber.promise;
|
|
} else {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
}
|
|
if (!w3) {
|
|
let componentKey3 = \`Child\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| context['Child'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[3] = w3.__owl__.id;
|
|
def2 = w3.__prepare(extra.fiber, undefined, undefined);
|
|
def2 = def2.then(vnode=>{if (w3.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 3, hook: {insert(vn) {let nvn=w3.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w3.destroy();}}});utils.defineProxy(vn4, pvnode);w3.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def2 = def2 || w3.__updateProps(props3, extra.fiber, undefined, undefined);
|
|
def2 = def2.then(()=>{if (w3.__owl__.isDestroyed) {return};let pvnode=w3.__owl__.pvnode;utils.defineProxy(vn4, pvnode);});
|
|
}
|
|
extra.promises.push(def2);
|
|
}
|
|
if (!context['env'].flag) {
|
|
//COMPONENT
|
|
let def6;
|
|
let w7 = 7 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[7]] : false;
|
|
let vn8 = {};
|
|
result = vn8;
|
|
let props7 = {};
|
|
if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) {
|
|
if (utils.shallowEqual(props7, w7.__owl__.currentFiber.props)) {
|
|
def6 = w7.__owl__.currentFiber.promise;
|
|
} else {
|
|
w7.destroy();
|
|
w7 = false;
|
|
}
|
|
}
|
|
if (!w7) {
|
|
let componentKey7 = \`OtherChild\`;
|
|
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7]|| context['OtherChild'];
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
|
w7 = new W7(parent, props7);
|
|
parent.__owl__.cmap[7] = w7.__owl__.id;
|
|
def6 = w7.__prepare(extra.fiber, undefined, undefined);
|
|
def6 = def6.then(vnode=>{if (w7.__owl__.isDestroyed){return}let pvnode=h(vnode.sel, {key: 7, hook: {insert(vn) {let nvn=w7.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w7.destroy();}}});utils.defineProxy(vn8, pvnode);w7.__owl__.pvnode = pvnode;});
|
|
} else {
|
|
def6 = def6 || w7.__updateProps(props7, extra.fiber, undefined, undefined);
|
|
def6 = def6.then(()=>{if (w7.__owl__.isDestroyed) {return};let pvnode=w7.__owl__.pvnode;utils.defineProxy(vn8, pvnode);});
|
|
}
|
|
extra.promises.push(def6);
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|