// 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = scope['state'].s; if (!_2) { throw new Error('QWeb error: Invalid loop expression')} let _3 = _4 = _2; if (!(_2 instanceof Array)) { _3 = Object.keys(_2); _4 = Object.values(_2); } let _length3 = _3.length; let _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] let _6 = scope['section'].blips; if (!_6) { throw new Error('QWeb error: Invalid loop expression')} let _7 = _8 = _6; if (!(_6 instanceof Array)) { _7 = Object.keys(_6); _8 = Object.values(_6); } let _length7 = _7.length; let _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 'Child' let k11 = \`__11__\${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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); if (false) { const nodeKey2 = 'str'; // Component 'Child' let k4 = \`__4__\` + 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 'Child' let w5 = '__6__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__6__']] : false; 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; c1.push(pvnode); } else { let componentKey5 = \`Child\`; let W5 = context.constructor.components[componentKey5] || QWeb.components[componentKey5]|| scope['Child']; if (!W5) {throw new Error('Cannot find the definition of component \\"' + componentKey5 + '\\"')} w5 = new W5(parent, props5); parent.__owl__.cmap['__6__'] = w5.__owl__.id; let fiber = w5.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__6__', hook: {remove() {},destroy(vn) {w5.destroy();}}}); c1.push(pvnode); w5.__owl__.pvnode = pvnode; } w5.__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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' const _4 = scope['state'].style; let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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=_4;});; 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['__3__'] = 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 = _4;}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'Child' const ref4 = \`child\`; let _5 = {'a':true}; Object.assign(_5, {b:scope['state'].b}) let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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: '__3__', hook: {insert(vn) {context.__owl__.refs[ref4] = w2;},remove() {},destroy(vn) {w2.destroy();delete context.__owl__.refs[ref4];}}}); c1.push(pvnode); w2.__owl__.pvnode = pvnode; } w2.__owl__.classObj=_5; 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); let h = this.h; let _7 = {'c':true}; Object.assign(_7, utils.toObj({d:scope['state'].d})) let c8 = [], p8 = {key:8,class:_7}; let vn8 = h('span', p8, c8); return vn8; }" `; 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'Child' const ref4 = \`child\`; let _5 = {'a':true}; Object.assign(_5, utils.toObj(scope['state'].b?'b':'')) let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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: '__3__', hook: {insert(vn) {context.__owl__.refs[ref4] = w2;},remove() {},destroy(vn) {w2.destroy();delete context.__owl__.refs[ref4];}}}); c1.push(pvnode); w2.__owl__.pvnode = pvnode; } w2.__owl__.classObj=_5; 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); let h = this.h; let _7 = {'c':true}; Object.assign(_7, utils.toObj(scope['state'].d?'d':'')) let c8 = [], p8 = {key:8,class:_7}; let vn8 = h('span', p8, c8); return vn8; }" `; 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = scope['state'].numbers; if (!_2) { throw new Error('QWeb error: Invalid loop expression')} let _3 = _4 = _2; if (!(_2 instanceof Array)) { _3 = Object.keys(_2); _4 = Object.values(_2); } let _length3 = _3.length; let _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 'ChildWidget' let k8 = \`__8__\` + 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component '{{state.widget}}' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = w2.__owl__.id; let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'Widget{{state.widget}}' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = w2.__owl__.id; let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'Child' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = w2.__owl__.id; let fiber = w2.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = scope['state'].counter; if (_2 != null) { c1.push({text: _2}); } // Component 'Child' let w3 = '__4__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__4__']] : 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['__4__'] = 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}utils.getComponent(context)['handler'](e);});}};}); let pvnode = h('dummy', {key: '__4__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let args4 = [3]; let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv'](...args4, e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let args4 = [{}]; let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv'](...args4, e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let args4 = [{}]; let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv'](...args4, e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let args4 = [{val:3}]; let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv'](...args4, e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = scope['state'].counter; if (_2 != null) { c1.push({text: _2}); } // Component 'Child' let w3 = '__4__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__4__']] : 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['__4__'] = 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}scope['state'].counter++});}};}); let pvnode = h('dummy', {key: '__4__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'ComponentA' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv'](e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'Child' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv'](e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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();utils.getComponent(context)['onEv'](e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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}utils.getComponent(context)['onEv1'](e);});vn.elm.addEventListener('ev-2', function (e) {if (!context.__owl__.isMounted){return}if (e.target !== vn.elm) {return}utils.getComponent(context)['onEv2'](e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); // Component 'child' let w2 = '__3__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__3__']] : 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['__3__'] = 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();utils.getComponent(context)['onEv1'](e);});vn.elm.addEventListener('ev-2', function (e) {if (!context.__owl__.isMounted){return}e.preventDefault();utils.getComponent(context)['onEv2'](e);});vn.elm.addEventListener('ev-3', function (e) {if (!context.__owl__.isMounted){return}e.stopPropagation();e.preventDefault();utils.getComponent(context)['onEv3'](e);});}};}); let pvnode = h('dummy', {key: '__3__', 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); let h = this.h; let c1 = [], p1 = {key:1}; let 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); const nodeKey2 = 'somestring'; // Component 'child' let k4 = \`__4__\` + 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__2\\" let utils = this.constructor.utils; let QWeb = this.constructor; let parent = context; let scope = Object.create(context); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = scope['items']; if (!_2) { throw new Error('QWeb error: Invalid loop expression')} let _3 = _4 = _2; if (!(_2 instanceof Array)) { _3 = Object.keys(_2); _4 = Object.values(_2); } let _length3 = _3.length; let _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 'Child' let k8 = \`__8__\` + nodeKey6; let args9 = [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}utils.getComponent(context)['onEv'](...args9, e);});}};}); 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-call handlers are properly bound through a t-call 1`] = ` "function anonymous(context, extra ) { // Template name: \\"sub\\" let utils = this.constructor.utils; let h = this.h; let c1 = extra.parentNode; let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('p', p2, c2); c1.push(vn2); extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['update'](e);}; p2.on['click'] = extra.handlers['click__3__']; c2.push({text: \`lucas\`}); }" `; exports[`t-call handlers with arguments are properly bound through a t-call 1`] = ` "function anonymous(context, extra ) { // Template name: \\"sub\\" let utils = this.constructor.utils; let scope = Object.create(context); let h = this.h; let c1 = extra.parentNode; let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('p', p2, c2); c1.push(vn2); let args3 = [scope['a']]; p2.on['click'] = function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['update'](...args3, e);}; c2.push({text: \`lucas\`}); }" `; exports[`t-model directive .lazy modifier 1`] = ` "function anonymous(context, extra ) { // Template name: \\"__template__1\\" let scope = Object.create(context); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('input', p2, c2); c1.push(vn2); let expr2 = scope['state']; p2.props = {value: expr2.text}; extra.handlers['__3__'] = extra.handlers['__3__'] || ((ev) => {expr2.text = ev.target.value}); p2.on['change'] = extra.handlers['__3__']; let c4 = [], p4 = {key:4}; let vn4 = h('span', p4, c4); c1.push(vn4); let _5 = scope['state'].text; if (_5 != null) { c4.push({text: _5}); } 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('input', p2, c2); c1.push(vn2); let expr2 = scope['state']; p2.props = {value: expr2.text}; extra.handlers['__3__'] = extra.handlers['__3__'] || ((ev) => {expr2.text = ev.target.value}); p2.on['input'] = extra.handlers['__3__']; let c4 = [], p4 = {key:4}; let vn4 = h('span', p4, c4); c1.push(vn4); let _5 = scope['state'].text; if (_5 != null) { c4.push({text: _5}); } 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('input', p2, c2); c1.push(vn2); let expr2 = scope['some']; p2.props = {value: expr2.text}; extra.handlers['__3__'] = extra.handlers['__3__'] || ((ev) => {expr2.text = ev.target.value}); p2.on['input'] = extra.handlers['__3__']; let c4 = [], p4 = {key:4}; let vn4 = h('span', p4, c4); c1.push(vn4); let _5 = scope['some'].text; if (_5 != null) { c4.push({text: _5}); } return vn1; }" `; exports[`t-model directive in a t-foreach 1`] = ` "function anonymous(context, extra ) { // Template name: \\"__template__1\\" let scope = Object.create(context); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = scope['state']; if (!_2) { throw new Error('QWeb error: Invalid loop expression')} let _3 = _4 = _2; if (!(_2 instanceof Array)) { _3 = Object.keys(_2); _4 = Object.values(_2); } let _length3 = _3.length; let _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; let _7 = 'checkbox'; let c8 = [], p8 = {key:nodeKey6,attrs:{type: _7},on:{}}; let vn8 = h('input', p8, c8); c1.push(vn8); let expr8 = scope['thing']; let k9 = \`__9__\` + 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('select', p2, c2); c1.push(vn2); let expr2 = scope['state']; p2.props = {value: expr2.color}; extra.handlers['__3__'] = extra.handlers['__3__'] || ((ev) => {expr2.color = ev.target.value}); p2.on['change'] = extra.handlers['__3__']; p2.hook = { create: (_, n) => { n.elm.value=expr2.color; }, }; let _4 = ''; let c5 = [], p5 = {key:5,attrs:{value: _4}}; let vn5 = h('option', p5, c5); c2.push(vn5); c5.push({text: \`Please select one\`}); let _6 = 'red'; let c7 = [], p7 = {key:7,attrs:{value: _6}}; let vn7 = h('option', p7, c7); c2.push(vn7); c7.push({text: \`Red\`}); let _8 = 'blue'; let c9 = [], p9 = {key:9,attrs:{value: _8}}; let vn9 = h('option', p9, c9); c2.push(vn9); c9.push({text: \`Blue\`}); let c10 = [], p10 = {key:10}; let vn10 = h('span', p10, c10); c1.push(vn10); c10.push({text: \`Choice: \`}); let _11 = scope['state'].color; if (_11 != null) { c10.push({text: _11}); } 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); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let c2 = [], p2 = {key:2,on:{}}; let vn2 = h('input', p2, c2); c1.push(vn2); let expr2 = scope['state'].something; p2.props = {value: expr2.text}; extra.handlers['__3__'] = extra.handlers['__3__'] || ((ev) => {expr2.text = ev.target.value}); p2.on['input'] = extra.handlers['__3__']; let c4 = [], p4 = {key:4}; let vn4 = h('span', p4, c4); c1.push(vn4); let _5 = scope['state'].something.text; if (_5 != null) { c4.push({text: _5}); } return vn1; }" `; exports[`t-model directive on an input type=radio 1`] = ` "function anonymous(context, extra ) { // Template name: \\"SomeComponent\\" let scope = Object.create(context); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = 'radio'; let _3 = 'one'; let _4 = 'One'; let c5 = [], p5 = {key:5,attrs:{type: _2,id: _3,value: _4},on:{}}; let vn5 = h('input', p5, c5); c1.push(vn5); let expr5 = scope['state']; p5.props = {checked:expr5.choice === 'One'}; extra.handlers['__6__'] = extra.handlers['__6__'] || ((ev) => {expr5.choice = ev.target.value}); p5.on['click'] = extra.handlers['__6__']; let _7 = 'radio'; let _8 = 'two'; let _9 = 'Two'; let c10 = [], p10 = {key:10,attrs:{type: _7,id: _8,value: _9},on:{}}; let vn10 = h('input', p10, c10); c1.push(vn10); let expr10 = scope['state']; p10.props = {checked:expr10.choice === 'Two'}; extra.handlers['__11__'] = extra.handlers['__11__'] || ((ev) => {expr10.choice = ev.target.value}); p10.on['click'] = extra.handlers['__11__']; let c12 = [], p12 = {key:12}; let vn12 = h('span', p12, c12); c1.push(vn12); c12.push({text: \`Choice: \`}); let _13 = scope['state'].choice; if (_13 != null) { c12.push({text: _13}); } return vn1; }" `; exports[`t-model directive on an input, type=checkbox 1`] = ` "function anonymous(context, extra ) { // Template name: \\"SomeComponent\\" let scope = Object.create(context); let h = this.h; let c1 = [], p1 = {key:1}; let vn1 = h('div', p1, c1); let _2 = 'checkbox'; let c3 = [], p3 = {key:3,attrs:{type: _2},on:{}}; let vn3 = h('input', p3, c3); c1.push(vn3); let expr3 = scope['state']; p3.props = {checked: expr3.flag}; extra.handlers['__4__'] = extra.handlers['__4__'] || ((ev) => {expr3.flag = ev.target.checked}); p3.on['input'] = extra.handlers['__4__']; let c5 = [], p5 = {key:5}; let vn5 = h('span', p5, c5); c1.push(vn5); if (scope['state'].flag) { c5.push({text: \`yes\`}); } else { c5.push({text: \`no\`}); } return vn1; }" `; 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; let h = this.h; // Component 'Child' let w1 = '__2__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__2__']] : false; let vn3 = {}; result = vn3; 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(vn3, 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['__2__'] = w1.__owl__.id; let fiber = w1.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__2__', hook: {remove() {},destroy(vn) {w1.destroy();}}}); utils.defineProxy(vn3, 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; let h = this.h; if (scope['env'].flag) { // Component 'Child' let w1 = '__2__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__2__']] : false; let vn3 = {}; result = vn3; 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(vn3, 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['__2__'] = w1.__owl__.id; let fiber = w1.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__2__', hook: {remove() {},destroy(vn) {w1.destroy();}}}); utils.defineProxy(vn3, pvnode); w1.__owl__.pvnode = pvnode; } w1.__owl__.parentLastFiberId = extra.fiber.id; } if (!scope['env'].flag) { // Component 'OtherChild' let w4 = '__5__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__5__']] : false; let vn6 = {}; result = vn6; let props4 = {}; if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { w4.destroy(); w4 = false; } if (w4) { w4.__updateProps(props4, extra.fiber, undefined); let pvnode = w4.__owl__.pvnode; utils.defineProxy(vn6, pvnode); } else { let componentKey4 = \`OtherChild\`; let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| scope['OtherChild']; if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')} w4 = new W4(parent, props4); parent.__owl__.cmap['__5__'] = w4.__owl__.id; let fiber = w4.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; }); let pvnode = h('dummy', {key: '__5__', hook: {remove() {},destroy(vn) {w4.destroy();}}}); utils.defineProxy(vn6, pvnode); w4.__owl__.pvnode = pvnode; } w4.__owl__.parentLastFiberId = extra.fiber.id; } return result; }" `;