mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
bc455be720
closes #554
1890 lines
71 KiB
Plaintext
1890 lines
71 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`basic widget properties reconciliation alg works for t-foreach in t-foreach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = scope['state'].s;
|
|
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;
|
|
const _origScope5 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i1 = 0; i1 < _length3; i1++) {
|
|
scope.section_first = i1 === 0
|
|
scope.section_last = i1 === _length3 - 1
|
|
scope.section_index = i1
|
|
scope.section = _3[i1]
|
|
scope.section_value = _4[i1]
|
|
var _6 = scope['section'].blips;
|
|
if (!_6) { throw new Error('QWeb error: Invalid loop expression')}
|
|
var _7 = _8 = _6;
|
|
if (!(_6 instanceof Array)) {
|
|
_7 = Object.keys(_6);
|
|
_8 = Object.values(_6);
|
|
}
|
|
var _length7 = _7.length;
|
|
const _origScope9 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i2 = 0; i2 < _length7; i2++) {
|
|
scope.blip_first = i2 === 0
|
|
scope.blip_last = i2 === _length7 - 1
|
|
scope.blip_index = i2
|
|
scope.blip = _7[i2]
|
|
scope.blip_value = _8[i2]
|
|
//COMPONENT
|
|
let k11 = \`__12__\${i1}__\${i2}__\`;
|
|
let w10 = k11 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k11]] : false;
|
|
let props10 = {blip:scope['blip']};
|
|
if (w10 && w10.__owl__.currentFiber && !w10.__owl__.vnode) {
|
|
w10.destroy();
|
|
w10 = false;
|
|
}
|
|
if (w10) {
|
|
w10.__updateProps(props10, extra.fiber, undefined);
|
|
let pvnode = w10.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey10 = \`Child\`;
|
|
let W10 = context.constructor.components[componentKey10] || QWeb.components[componentKey10]|| scope['Child'];
|
|
if (!W10) {throw new Error('Cannot find the definition of component \\"' + componentKey10 + '\\"')}
|
|
w10 = new W10(parent, props10);
|
|
parent.__owl__.cmap[k11] = w10.__owl__.id;
|
|
let fiber = w10.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k11, hook: {remove() {},destroy(vn) {w10.destroy();}}});
|
|
c1.push(pvnode);
|
|
w10.__owl__.pvnode = pvnode;
|
|
}
|
|
w10.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
scope = _origScope9;
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`basic widget properties t-key on a component with t-if, and a sibling component 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
if (false) {
|
|
const nodeKey2 = 'str';
|
|
//COMPONENT
|
|
let k4 = \`__5__\` + nodeKey2;
|
|
let w3 = k4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k4]] : false;
|
|
let props3 = {};
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
if (w3) {
|
|
w3.__updateProps(props3, extra.fiber, undefined);
|
|
let pvnode = w3.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey3 = \`Child\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| scope['Child'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[k4] = w3.__owl__.id;
|
|
let fiber = w3.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k4, hook: {remove() {},destroy(vn) {w3.destroy();}}});
|
|
c1.push(pvnode);
|
|
w3.__owl__.pvnode = pvnode;
|
|
}
|
|
w3.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
//COMPONENT
|
|
let k7 = \`__8__\`;
|
|
let w6 = k7 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k7]] : false;
|
|
let props6 = {};
|
|
if (w6 && w6.__owl__.currentFiber && !w6.__owl__.vnode) {
|
|
w6.destroy();
|
|
w6 = false;
|
|
}
|
|
if (w6) {
|
|
w6.__updateProps(props6, extra.fiber, undefined);
|
|
let pvnode = w6.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey6 = \`Child\`;
|
|
let W6 = context.constructor.components[componentKey6] || QWeb.components[componentKey6]|| scope['Child'];
|
|
if (!W6) {throw new Error('Cannot find the definition of component \\"' + componentKey6 + '\\"')}
|
|
w6 = new W6(parent, props6);
|
|
parent.__owl__.cmap[k7] = w6.__owl__.id;
|
|
let fiber = w6.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k7, hook: {remove() {},destroy(vn) {w6.destroy();}}});
|
|
c1.push(pvnode);
|
|
w6.__owl__.pvnode = pvnode;
|
|
}
|
|
w6.__owl__.parentLastFiberId = extra.fiber.id;
|
|
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
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
const _5 = scope['state'].style;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined).then(()=>{if (w2.__owl__.isDestroyed) {return};w2.el.style=_5;});;
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.style = _5;}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
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
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
const ref5 = \`child\`;
|
|
let _6 = {'a':true};
|
|
Object.assign(_6, {b:scope['state'].b})
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['Child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {insert(vn) {context.__owl__.refs[ref5] = w2;},remove() {},destroy(vn) {w2.destroy();delete context.__owl__.refs[ref5];}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.classObj=_6;
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
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
|
|
) {
|
|
// Template name: \\"Child\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let _8 = {'c':true};
|
|
Object.assign(_8, utils.toObj({d:scope['state'].d}))
|
|
let c9 = [], p9 = {key:9,class:_8};
|
|
var vn9 = h('span', p9, c9);
|
|
return vn9;
|
|
}"
|
|
`;
|
|
|
|
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
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
const ref5 = \`child\`;
|
|
let _6 = {'a':true};
|
|
Object.assign(_6, utils.toObj(scope['state'].b?'b':''))
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['Child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {insert(vn) {context.__owl__.refs[ref5] = w2;},remove() {},destroy(vn) {w2.destroy();delete context.__owl__.refs[ref5];}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.classObj=_6;
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
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
|
|
) {
|
|
// Template name: \\"Child\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let _8 = {'c':true};
|
|
Object.assign(_8, utils.toObj(scope['state'].d?'d':''))
|
|
let c9 = [], p9 = {key:9,class:_8};
|
|
var vn9 = h('span', p9, c9);
|
|
return vn9;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition sub components with some state rendered in a loop 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"parent\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = scope['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;
|
|
const _origScope5 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i1 = 0; i1 < _length3; i1++) {
|
|
scope.number_first = i1 === 0
|
|
scope.number_last = i1 === _length3 - 1
|
|
scope.number_index = i1
|
|
scope.number = _3[i1]
|
|
scope.number_value = _4[i1]
|
|
const nodeKey6 = scope['number'];
|
|
//COMPONENT
|
|
let k8 = \`__9__\` + nodeKey6;
|
|
let w7 = k8 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k8]] : false;
|
|
let props7 = {};
|
|
if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) {
|
|
w7.destroy();
|
|
w7 = false;
|
|
}
|
|
if (w7) {
|
|
w7.__updateProps(props7, extra.fiber, undefined);
|
|
let pvnode = w7.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey7 = \`ChildWidget\`;
|
|
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7]|| scope['ChildWidget'];
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
|
w7 = new W7(parent, props7);
|
|
parent.__owl__.cmap[k8] = w7.__owl__.id;
|
|
let fiber = w7.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k8, hook: {remove() {},destroy(vn) {w7.destroy();}}});
|
|
c1.push(pvnode);
|
|
w7.__owl__.pvnode = pvnode;
|
|
}
|
|
w7.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition t-component with dynamic value 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = (scope['state'].widget);
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`composition t-component with dynamic value 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Widget\${scope['state'].widget}\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`dynamic t-props basic use 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = Object.assign({}, scope['some'].obj);
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['Child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with getter as handler 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = scope['state'].counter;
|
|
if (_2 || _2 === 0) {
|
|
c1.push({text: _2});
|
|
}
|
|
//COMPONENT
|
|
let k4 = \`__5__\`;
|
|
let w3 = k4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k4]] : false;
|
|
let props3 = {};
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
if (w3) {
|
|
w3.__updateProps(props3, extra.fiber, undefined);
|
|
let pvnode = w3.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey3 = \`Child\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| scope['Child'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[k4] = w3.__owl__.id;
|
|
let fiber = w3.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['handler'];if (fn) { fn.call(context, e); } else { context.handler; }});}};});
|
|
let pvnode = h('dummy', {key: k4, hook: {remove() {},destroy(vn) {w3.destroy();}}});
|
|
c1.push(pvnode);
|
|
w3.__owl__.pvnode = pvnode;
|
|
}
|
|
w3.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to argument 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv'];if (fn) { fn.call(context, 3, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
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
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv'];if (fn) { fn.call(context, {}, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to empty object 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv'];if (fn) { fn.call(context, {}, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with handler bound to object 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv'];if (fn) { fn.call(context, {val:3}, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with inline statement 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = scope['state'].counter;
|
|
if (_2 || _2 === 0) {
|
|
c1.push({text: _2});
|
|
}
|
|
//COMPONENT
|
|
let k4 = \`__5__\`;
|
|
let w3 = k4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k4]] : false;
|
|
let props3 = {};
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
if (w3) {
|
|
w3.__updateProps(props3, extra.fiber, undefined);
|
|
let pvnode = w3.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey3 = \`Child\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| scope['Child'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[k4] = w3.__owl__.id;
|
|
let fiber = w3.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['state.counter++'];if (fn) { fn.call(context, e); } else { context.state.counter++; }});}};});
|
|
let pvnode = h('dummy', {key: k4, hook: {remove() {},destroy(vn) {w3.destroy();}}});
|
|
c1.push(pvnode);
|
|
w3.__owl__.pvnode = pvnode;
|
|
}
|
|
w3.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with no handler (only modifiers) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__3\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`ComponentA\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['ComponentA'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv'];if (fn) { fn.call(context, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with prevent and self modifiers (order matters) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['Child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}e.preventDefault();if (e.target !== vn.elm) {return}const fn = context['onEv'];if (fn) { fn.call(context, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with self and prevent modifiers (order matters) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}if (e.target !== vn.elm) {return}e.preventDefault();const fn = context['onEv'];if (fn) { fn.call(context, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with self modifier 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev-1', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv1'];if (fn) { fn.call(context, e); } else { context.onEv1; }});vn.elm.addEventListener('ev-2', function (e) {if(!context.__owl__.isMounted){return}if (e.target !== vn.elm) {return}const fn = context['onEv2'];if (fn) { fn.call(context, e); } else { context.onEv2; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`other directives with t-component t-on with stop and/or prevent modifiers 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"ParentWidget\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, undefined);
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`child\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['child'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev-1', function (e) {if(!context.__owl__.isMounted){return}e.stopPropagation();const fn = context['onEv1'];if (fn) { fn.call(context, e); } else { context.onEv1; }});vn.elm.addEventListener('ev-2', function (e) {if(!context.__owl__.isMounted){return}e.preventDefault();const fn = context['onEv2'];if (fn) { fn.call(context, e); } else { context.onEv2; }});vn.elm.addEventListener('ev-3', function (e) {if(!context.__owl__.isMounted){return}e.stopPropagation();e.preventDefault();const fn = context['onEv3'];if (fn) { fn.call(context, e); } else { context.onEv3; }});}};});
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`random stuff/miscellaneous can inject values in tagged templates 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
this.subTemplates['__template__1'].call(this, Object.assign(Object.create(context), scope), Object.assign({}, extra, {parentNode: c1}));
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`random stuff/miscellaneous snapshotting compiled code 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Parent\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
const nodeKey2 = 'somestring';
|
|
//COMPONENT
|
|
let k4 = \`__5__\` + nodeKey2;
|
|
let w3 = k4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k4]] : false;
|
|
let props3 = {flag:scope['state'].flag};
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
if (w3) {
|
|
w3.__updateProps(props3, extra.fiber, undefined);
|
|
let pvnode = w3.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey3 = \`child\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| scope['child'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[k4] = w3.__owl__.id;
|
|
let fiber = w3.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k4, hook: {remove() {},destroy(vn) {w3.destroy();}}});
|
|
c1.push(pvnode);
|
|
w3.__owl__.pvnode = pvnode;
|
|
}
|
|
w3.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`random stuff/miscellaneous t-on with handler bound to dynamic argument on a t-foreach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = scope['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;
|
|
const _origScope5 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i1 = 0; i1 < _length3; i1++) {
|
|
scope.item_first = i1 === 0
|
|
scope.item_last = i1 === _length3 - 1
|
|
scope.item_index = i1
|
|
scope.item = _3[i1]
|
|
scope.item_value = _4[i1]
|
|
const nodeKey6 = scope['item'];
|
|
//COMPONENT
|
|
let k8 = \`__9__\` + nodeKey6;
|
|
let arg10 = scope['item'];
|
|
let w7 = k8 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k8]] : false;
|
|
let props7 = {};
|
|
if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) {
|
|
w7.destroy();
|
|
w7 = false;
|
|
}
|
|
if (w7) {
|
|
w7.__updateProps(props7, extra.fiber, undefined);
|
|
let pvnode = w7.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey7 = \`Child\`;
|
|
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7]|| scope['Child'];
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
|
w7 = new W7(parent, props7);
|
|
parent.__owl__.cmap[k8] = w7.__owl__.id;
|
|
let fiber = w7.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if(!context.__owl__.isMounted){return}const fn = context['onEv'];if (fn) { fn.call(context, arg10, e); } else { context.onEv; }});}};});
|
|
let pvnode = h('dummy', {key: k8, hook: {remove() {},destroy(vn) {w7.destroy();}}});
|
|
c1.push(pvnode);
|
|
w7.__owl__.pvnode = pvnode;
|
|
}
|
|
w7.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive .lazy modifier 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
let expr2 = scope['state'];
|
|
let k3 = \`__4__\`;
|
|
p2.props = {value: expr2.text};
|
|
extra.handlers[k3] = extra.handlers[k3] || ((ev) => {expr2.text = ev.target.value});
|
|
p2.on['change'] = extra.handlers[k3];
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
var _6 = scope['state'].text;
|
|
if (_6 || _6 === 0) {
|
|
c5.push({text: _6});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive basic use, on an input 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
let expr2 = scope['state'];
|
|
let k3 = \`__4__\`;
|
|
p2.props = {value: expr2.text};
|
|
extra.handlers[k3] = extra.handlers[k3] || ((ev) => {expr2.text = ev.target.value});
|
|
p2.on['input'] = extra.handlers[k3];
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
var _6 = scope['state'].text;
|
|
if (_6 || _6 === 0) {
|
|
c5.push({text: _6});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive basic use, on another key in component 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"SomeComponent\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
let expr2 = scope['some'];
|
|
let k3 = \`__4__\`;
|
|
p2.props = {value: expr2.text};
|
|
extra.handlers[k3] = extra.handlers[k3] || ((ev) => {expr2.text = ev.target.value});
|
|
p2.on['input'] = extra.handlers[k3];
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
var _6 = scope['some'].text;
|
|
if (_6 || _6 === 0) {
|
|
c5.push({text: _6});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive in a t-foreach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = scope['state'];
|
|
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;
|
|
const _origScope5 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i1 = 0; i1 < _length3; i1++) {
|
|
scope.thing_first = i1 === 0
|
|
scope.thing_last = i1 === _length3 - 1
|
|
scope.thing_index = i1
|
|
scope.thing = _3[i1]
|
|
scope.thing_value = _4[i1]
|
|
const nodeKey6 = scope['thing'].id;
|
|
var _7 = 'checkbox';
|
|
let c8 = [], p8 = {key:nodeKey6,attrs:{type: _7},on:{}};
|
|
var vn8 = h('input', p8, c8);
|
|
c1.push(vn8);
|
|
let expr8 = scope['thing'];
|
|
let k9 = \`__10__\` + nodeKey6;
|
|
p8.props = {checked: expr8.f};
|
|
extra.handlers[k9] = extra.handlers[k9] || ((ev) => {expr8.f = ev.target.checked});
|
|
p8.on['input'] = extra.handlers[k9];
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on a select 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"SomeComponent\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('select', p2, c2);
|
|
c1.push(vn2);
|
|
let expr2 = scope['state'];
|
|
let k3 = \`__4__\`;
|
|
p2.props = {value: expr2.color};
|
|
extra.handlers[k3] = extra.handlers[k3] || ((ev) => {expr2.color = ev.target.value});
|
|
p2.on['change'] = extra.handlers[k3];
|
|
p2.hook = {
|
|
create: (_, n) => {
|
|
n.elm.value=expr2.color;
|
|
},
|
|
};
|
|
var _5 = '';
|
|
let c6 = [], p6 = {key:6,attrs:{value: _5}};
|
|
var vn6 = h('option', p6, c6);
|
|
c2.push(vn6);
|
|
c6.push({text: \`Please select one\`});
|
|
var _7 = 'red';
|
|
let c8 = [], p8 = {key:8,attrs:{value: _7}};
|
|
var vn8 = h('option', p8, c8);
|
|
c2.push(vn8);
|
|
c8.push({text: \`Red\`});
|
|
var _9 = 'blue';
|
|
let c10 = [], p10 = {key:10,attrs:{value: _9}};
|
|
var vn10 = h('option', p10, c10);
|
|
c2.push(vn10);
|
|
c10.push({text: \`Blue\`});
|
|
let c11 = [], p11 = {key:11};
|
|
var vn11 = h('span', p11, c11);
|
|
c1.push(vn11);
|
|
c11.push({text: \`Choice: \`});
|
|
var _12 = scope['state'].color;
|
|
if (_12 || _12 === 0) {
|
|
c11.push({text: _12});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on a sub state key 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
var vn2 = h('input', p2, c2);
|
|
c1.push(vn2);
|
|
let expr2 = scope['state'].something;
|
|
let k3 = \`__4__\`;
|
|
p2.props = {value: expr2.text};
|
|
extra.handlers[k3] = extra.handlers[k3] || ((ev) => {expr2.text = ev.target.value});
|
|
p2.on['input'] = extra.handlers[k3];
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
var _6 = scope['state'].something.text;
|
|
if (_6 || _6 === 0) {
|
|
c5.push({text: _6});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on an input type=radio 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"SomeComponent\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
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);
|
|
let expr5 = scope['state'];
|
|
let k6 = \`__7__\`;
|
|
p5.props = {checked:expr5.choice === 'One'};
|
|
extra.handlers[k6] = extra.handlers[k6] || ((ev) => {expr5.choice = ev.target.value});
|
|
p5.on['click'] = extra.handlers[k6];
|
|
var _8 = 'radio';
|
|
var _9 = 'two';
|
|
var _10 = 'Two';
|
|
let c11 = [], p11 = {key:11,attrs:{type: _8,id: _9,value: _10},on:{}};
|
|
var vn11 = h('input', p11, c11);
|
|
c1.push(vn11);
|
|
let expr11 = scope['state'];
|
|
let k12 = \`__13__\`;
|
|
p11.props = {checked:expr11.choice === 'Two'};
|
|
extra.handlers[k12] = extra.handlers[k12] || ((ev) => {expr11.choice = ev.target.value});
|
|
p11.on['click'] = extra.handlers[k12];
|
|
let c14 = [], p14 = {key:14};
|
|
var vn14 = h('span', p14, c14);
|
|
c1.push(vn14);
|
|
c14.push({text: \`Choice: \`});
|
|
var _15 = scope['state'].choice;
|
|
if (_15 || _15 === 0) {
|
|
c14.push({text: _15});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-model directive on an input, type=checkbox 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"SomeComponent\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
var _2 = 'checkbox';
|
|
let c3 = [], p3 = {key:3,attrs:{type: _2},on:{}};
|
|
var vn3 = h('input', p3, c3);
|
|
c1.push(vn3);
|
|
let expr3 = scope['state'];
|
|
let k4 = \`__5__\`;
|
|
p3.props = {checked: expr3.flag};
|
|
extra.handlers[k4] = extra.handlers[k4] || ((ev) => {expr3.flag = ev.target.checked});
|
|
p3.on['input'] = extra.handlers[k4];
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
if (scope['state'].flag) {
|
|
c6.push({text: \`yes\`});
|
|
}
|
|
else {
|
|
c6.push({text: \`no\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Parent\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, Object.assign(Object.create(context), scope));
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Dialog\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['Dialog'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
w2.__owl__.slotId = 1;
|
|
let fiber = w2.__prepare(extra.fiber, Object.assign(Object.create(context), scope), () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Dialog\\"
|
|
var h = this.h;
|
|
let c7 = [], p7 = {key:7};
|
|
var vn7 = h('div', p7, c7);
|
|
let c8 = [], p8 = {key:8};
|
|
var vn8 = h('div', p8, c8);
|
|
c7.push(vn8);
|
|
const slot9 = this.constructor.slots[context.__owl__.slotId + '_' + 'header'];
|
|
if (slot9) {
|
|
slot9.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: c8, parent: extra.parent || context}));
|
|
}
|
|
let c10 = [], p10 = {key:10};
|
|
var vn10 = h('div', p10, c10);
|
|
c7.push(vn10);
|
|
const slot11 = this.constructor.slots[context.__owl__.slotId + '_' + 'footer'];
|
|
if (slot11) {
|
|
slot11.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: c10, parent: extra.parent || context}));
|
|
}
|
|
return vn7;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 3`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_header_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
c5.push({text: \`header\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive can define and call slots 4`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_footer_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
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
|
|
) {
|
|
// Template name: \\"slot_default_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
c5.push({text: \`sts rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive dafault slots can define a default content 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
var h = this.h;
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
const slot6 = this.constructor.slots[context.__owl__.slotId + '_' + 'default'];
|
|
if (slot6) {
|
|
slot6.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: c5, parent: extra.parent || context}));
|
|
} else {
|
|
c5.push({text: \`default content\`});
|
|
}
|
|
return vn5;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive default slot work with text nodes 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_default_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
c1.push({text: \`sts rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive multiple roots are allowed in a default slot 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_default_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
c5.push({text: \`sts\`});
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive multiple roots are allowed in a named slot 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_content_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
c1.push(vn5);
|
|
c5.push({text: \`sts\`});
|
|
let c6 = [], p6 = {key:6};
|
|
var vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
c6.push({text: \`rocks\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive named slots can define a default content 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
var h = this.h;
|
|
let c5 = [], p5 = {key:5};
|
|
var vn5 = h('span', p5, c5);
|
|
const slot6 = this.constructor.slots[context.__owl__.slotId + '_' + 'header'];
|
|
if (slot6) {
|
|
slot6.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: c5, parent: extra.parent || context}));
|
|
} else {
|
|
c5.push({text: \`default content\`});
|
|
}
|
|
return vn5;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive refs are properly bound in slots 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_footer_template\\"
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let c9 = [], p9 = {key:9,on:{}};
|
|
var vn9 = h('button', p9, c9);
|
|
c1.push(vn9);
|
|
extra.handlers['click' + 9] = extra.handlers['click' + 9] || function (e) {if (!context.__owl__.isMounted){return}const fn = context['doSomething'];if (fn) { fn.call(context, e); } else { context.doSomething; }};
|
|
p9.on['click'] = extra.handlers['click' + 9];
|
|
const ref10 = \`myButton\`;
|
|
p9.hook = {
|
|
create: (_, n) => {
|
|
context.__owl__.refs[ref10] = n.elm;
|
|
},
|
|
destroy: () => {
|
|
delete context.__owl__.refs[ref10];
|
|
},
|
|
};
|
|
c9.push({text: \`do something\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_footer_template\\"
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let c9 = [], p9 = {key:9,on:{}};
|
|
var vn9 = h('button', p9, c9);
|
|
c1.push(vn9);
|
|
extra.handlers['click' + 9] = extra.handlers['click' + 9] || function (e) {if (!context.__owl__.isMounted){return}const fn = context['doSomething'];if (fn) { fn.call(context, e); } else { context.doSomething; }};
|
|
p9.on['click'] = extra.handlers['click' + 9];
|
|
c9.push({text: \`do something\`});
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Link\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
var _13 = scope['props'].to;
|
|
let c14 = [], p14 = {key:14,attrs:{href: _13}};
|
|
var vn14 = h('a', p14, c14);
|
|
const slot15 = this.constructor.slots[context.__owl__.slotId + '_' + 'default'];
|
|
if (slot15) {
|
|
slot15.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: c14, parent: extra.parent || context}));
|
|
}
|
|
return vn14;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"App\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
var vn2 = h('u', p2, c2);
|
|
c1.push(vn2);
|
|
var _3 = scope['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;
|
|
const _origScope6 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i1 = 0; i1 < _length4; i1++) {
|
|
scope.user_first = i1 === 0
|
|
scope.user_last = i1 === _length4 - 1
|
|
scope.user_index = i1
|
|
scope.user = _4[i1]
|
|
scope.user_value = _5[i1]
|
|
const nodeKey7 = scope['user'].id;
|
|
let c8 = [], p8 = {key:nodeKey7};
|
|
var vn8 = h('li', p8, c8);
|
|
c2.push(vn8);
|
|
//COMPONENT
|
|
let k10 = \`__11__\` + nodeKey7;
|
|
let w9 = k10 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k10]] : false;
|
|
let props9 = {to:'/user/'+scope['user'].id};
|
|
if (w9 && w9.__owl__.currentFiber && !w9.__owl__.vnode) {
|
|
w9.destroy();
|
|
w9 = false;
|
|
}
|
|
if (w9) {
|
|
w9.__updateProps(props9, extra.fiber, Object.assign(Object.create(context), scope));
|
|
let pvnode = w9.__owl__.pvnode;
|
|
c8.push(pvnode);
|
|
} else {
|
|
let componentKey9 = \`Link\`;
|
|
let W9 = context.constructor.components[componentKey9] || QWeb.components[componentKey9]|| scope['Link'];
|
|
if (!W9) {throw new Error('Cannot find the definition of component \\"' + componentKey9 + '\\"')}
|
|
w9 = new W9(parent, props9);
|
|
parent.__owl__.cmap[k10] = w9.__owl__.id;
|
|
w9.__owl__.slotId = 1;
|
|
let fiber = w9.__prepare(extra.fiber, Object.assign(Object.create(context), scope), () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k10, hook: {remove() {},destroy(vn) {w9.destroy();}}});
|
|
c8.push(pvnode);
|
|
w9.__owl__.pvnode = pvnode;
|
|
}
|
|
w9.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
scope = _origScope6;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 3`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_default_template\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c8 = extra.parentNode;
|
|
c8.push({text: \`User \`});
|
|
var _12 = scope['user'].name;
|
|
if (_12 || _12 === 0) {
|
|
c8.push({text: _12});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Link\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
var _12 = scope['props'].to;
|
|
let c13 = [], p13 = {key:13,attrs:{href: _12}};
|
|
var vn13 = h('a', p13, c13);
|
|
const slot14 = this.constructor.slots[context.__owl__.slotId + '_' + 'default'];
|
|
if (slot14) {
|
|
slot14.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: c13, parent: extra.parent || context}));
|
|
}
|
|
return vn13;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"App\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
var vn2 = h('u', p2, c2);
|
|
c1.push(vn2);
|
|
var _3 = scope['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;
|
|
const _origScope6 = scope;
|
|
scope = Object.assign(Object.create(context), scope);
|
|
for (let i1 = 0; i1 < _length4; i1++) {
|
|
scope.user_first = i1 === 0
|
|
scope.user_last = i1 === _length4 - 1
|
|
scope.user_index = i1
|
|
scope.user = _4[i1]
|
|
scope.user_value = _5[i1]
|
|
const nodeKey7 = scope['user'].id;
|
|
let c8 = [], p8 = {key:nodeKey7};
|
|
var vn8 = h('li', p8, c8);
|
|
c2.push(vn8);
|
|
scope.userdescr = 'User '+scope['user'].name;
|
|
//COMPONENT
|
|
let k10 = \`__11__\` + nodeKey7;
|
|
let w9 = k10 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k10]] : false;
|
|
let props9 = {to:'/user/'+scope['user'].id};
|
|
if (w9 && w9.__owl__.currentFiber && !w9.__owl__.vnode) {
|
|
w9.destroy();
|
|
w9 = false;
|
|
}
|
|
if (w9) {
|
|
w9.__updateProps(props9, extra.fiber, Object.assign(Object.create(context), scope));
|
|
let pvnode = w9.__owl__.pvnode;
|
|
c8.push(pvnode);
|
|
} else {
|
|
let componentKey9 = \`Link\`;
|
|
let W9 = context.constructor.components[componentKey9] || QWeb.components[componentKey9]|| scope['Link'];
|
|
if (!W9) {throw new Error('Cannot find the definition of component \\"' + componentKey9 + '\\"')}
|
|
w9 = new W9(parent, props9);
|
|
parent.__owl__.cmap[k10] = w9.__owl__.id;
|
|
w9.__owl__.slotId = 1;
|
|
let fiber = w9.__prepare(extra.fiber, Object.assign(Object.create(context), scope), () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k10, hook: {remove() {},destroy(vn) {w9.destroy();}}});
|
|
c8.push(pvnode);
|
|
w9.__owl__.pvnode = pvnode;
|
|
}
|
|
w9.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
scope = _origScope6;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 3`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_default_template\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c8 = extra.parentNode;
|
|
if (scope.userdescr || scope.userdescr === 0) {
|
|
c8.push({text: scope.userdescr});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 4 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"App\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
var vn1 = h('div', p1, c1);
|
|
scope.userdescr = 'User '+scope['state'].user.name;
|
|
//COMPONENT
|
|
let k3 = \`__4__\`;
|
|
let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
|
|
let props2 = {to:'/user/'+scope['state'].user.id};
|
|
if (w2 && w2.__owl__.currentFiber && !w2.__owl__.vnode) {
|
|
w2.destroy();
|
|
w2 = false;
|
|
}
|
|
if (w2) {
|
|
w2.__updateProps(props2, extra.fiber, Object.assign(Object.create(context), scope));
|
|
let pvnode = w2.__owl__.pvnode;
|
|
c1.push(pvnode);
|
|
} else {
|
|
let componentKey2 = \`Link\`;
|
|
let W2 = context.constructor.components[componentKey2] || QWeb.components[componentKey2]|| scope['Link'];
|
|
if (!W2) {throw new Error('Cannot find the definition of component \\"' + componentKey2 + '\\"')}
|
|
w2 = new W2(parent, props2);
|
|
parent.__owl__.cmap[k3] = w2.__owl__.id;
|
|
w2.__owl__.slotId = 1;
|
|
let fiber = w2.__prepare(extra.fiber, Object.assign(Object.create(context), scope), () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k3, hook: {remove() {},destroy(vn) {w2.destroy();}}});
|
|
c1.push(pvnode);
|
|
w2.__owl__.pvnode = pvnode;
|
|
}
|
|
w2.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 4 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"slot_default_template\\"
|
|
let scope = Object.create(context);
|
|
var h = this.h;
|
|
let c1 = extra.parentNode;
|
|
if (scope.userdescr || scope.userdescr === 0) {
|
|
c1.push({text: scope.userdescr});
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-slot directive template can just return a slot 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__2\\"
|
|
let utils = this.constructor.utils;
|
|
let result;
|
|
var h = this.h;
|
|
const slot8 = this.constructor.slots[context.__owl__.slotId + '_' + 'default'];
|
|
if (slot8) {
|
|
let children9= []
|
|
result = {}
|
|
slot8.call(this, context.__owl__.scope, Object.assign({}, extra, {parentNode: children9, parent: extra.parent || context}));
|
|
utils.defineProxy(result, children9[0]);
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`top level sub widgets basic use 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Parent\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
var h = this.h;
|
|
//COMPONENT
|
|
let k2 = \`__3__\`;
|
|
let w1 = k2 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k2]] : false;
|
|
let vn4 = {};
|
|
result = vn4;
|
|
let props1 = {p:1};
|
|
if (w1 && w1.__owl__.currentFiber && !w1.__owl__.vnode) {
|
|
w1.destroy();
|
|
w1 = false;
|
|
}
|
|
if (w1) {
|
|
w1.__updateProps(props1, extra.fiber, undefined);
|
|
let pvnode = w1.__owl__.pvnode;
|
|
utils.defineProxy(vn4, pvnode);
|
|
} else {
|
|
let componentKey1 = \`Child\`;
|
|
let W1 = context.constructor.components[componentKey1] || QWeb.components[componentKey1]|| scope['Child'];
|
|
if (!W1) {throw new Error('Cannot find the definition of component \\"' + componentKey1 + '\\"')}
|
|
w1 = new W1(parent, props1);
|
|
parent.__owl__.cmap[k2] = w1.__owl__.id;
|
|
let fiber = w1.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k2, hook: {remove() {},destroy(vn) {w1.destroy();}}});
|
|
utils.defineProxy(vn4, pvnode);
|
|
w1.__owl__.pvnode = pvnode;
|
|
}
|
|
w1.__owl__.parentLastFiberId = extra.fiber.id;
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`top level sub widgets can select a sub widget 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__3\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
var h = this.h;
|
|
if (scope['env'].flag) {
|
|
//COMPONENT
|
|
let k2 = \`__3__\`;
|
|
let w1 = k2 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k2]] : false;
|
|
let vn4 = {};
|
|
result = vn4;
|
|
let props1 = {};
|
|
if (w1 && w1.__owl__.currentFiber && !w1.__owl__.vnode) {
|
|
w1.destroy();
|
|
w1 = false;
|
|
}
|
|
if (w1) {
|
|
w1.__updateProps(props1, extra.fiber, undefined);
|
|
let pvnode = w1.__owl__.pvnode;
|
|
utils.defineProxy(vn4, pvnode);
|
|
} else {
|
|
let componentKey1 = \`Child\`;
|
|
let W1 = context.constructor.components[componentKey1] || QWeb.components[componentKey1]|| scope['Child'];
|
|
if (!W1) {throw new Error('Cannot find the definition of component \\"' + componentKey1 + '\\"')}
|
|
w1 = new W1(parent, props1);
|
|
parent.__owl__.cmap[k2] = w1.__owl__.id;
|
|
let fiber = w1.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k2, hook: {remove() {},destroy(vn) {w1.destroy();}}});
|
|
utils.defineProxy(vn4, pvnode);
|
|
w1.__owl__.pvnode = pvnode;
|
|
}
|
|
w1.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
if (!scope['env'].flag) {
|
|
//COMPONENT
|
|
let k6 = \`__7__\`;
|
|
let w5 = k6 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k6]] : false;
|
|
let vn8 = {};
|
|
result = vn8;
|
|
let props5 = {};
|
|
if (w5 && w5.__owl__.currentFiber && !w5.__owl__.vnode) {
|
|
w5.destroy();
|
|
w5 = false;
|
|
}
|
|
if (w5) {
|
|
w5.__updateProps(props5, extra.fiber, undefined);
|
|
let pvnode = w5.__owl__.pvnode;
|
|
utils.defineProxy(vn8, pvnode);
|
|
} else {
|
|
let componentKey5 = \`OtherChild\`;
|
|
let W5 = context.constructor.components[componentKey5] || QWeb.components[componentKey5]|| scope['OtherChild'];
|
|
if (!W5) {throw new Error('Cannot find the definition of component \\"' + componentKey5 + '\\"')}
|
|
w5 = new W5(parent, props5);
|
|
parent.__owl__.cmap[k6] = w5.__owl__.id;
|
|
let fiber = w5.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k6, hook: {remove() {},destroy(vn) {w5.destroy();}}});
|
|
utils.defineProxy(vn8, pvnode);
|
|
w5.__owl__.pvnode = pvnode;
|
|
}
|
|
w5.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|