// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`basic widget properties can handle empty props 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 = {val:undefined};
    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[`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.create(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 key1 = 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.create(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]
            let key2 = i2;
            // Component 'Child'
            let k11 = \`__11__\${key1}__\${key2}__\`;
            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 same t-keys in two different places 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 c2 = [], p2 = {key:2};
    let vn2 = h('div', p2, c2);
    c1.push(vn2);
    {
        let key0 = 1;
        // Component 'Child'
        let k4 = \`__4__\${key0}__\`;
        let w3 = k4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k4]] : false;
        let props3 = {blip:'1'};
        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;
            c2.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();}}});
            c2.push(pvnode);
            w3.__owl__.pvnode = pvnode;
        }
        w3.__owl__.parentLastFiberId = extra.fiber.id;
    }
    let c5 = [], p5 = {key:5};
    let vn5 = h('div', p5, c5);
    c1.push(vn5);
    {
        let key0 = 1;
        // Component 'Child'
        let k7 = \`__7__\${key0}__\`;
        let w6 = k7 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k7]] : false;
        let props6 = {blip:'2'};
        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;
            c5.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();}}});
            c5.push(pvnode);
            w6.__owl__.pvnode = pvnode;
        }
        w6.__owl__.parentLastFiberId = extra.fiber.id;
    }
    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) {
        {
            let key0 = 'str';
            // Component 'Child'
            let k3 = \`__3__\${key0}__\`;
            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; });
                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;
        }
    }
    // Component 'Child'
    let w4 = '__5__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__5__']] : false;
    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;
        c1.push(pvnode);
    } else {
        let componentKey4 = \`Child\`;
        let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4]|| scope['Child'];
        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();}}});
        c1.push(pvnode);
        w4.__owl__.pvnode = pvnode;
    }
    w4.__owl__.parentLastFiberId = extra.fiber.id;
    return vn1;
}"
`;

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.create(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]
        let key1 = i1;
        {
            let key1 = scope['number'];
            // Component 'ChildWidget'
            let k7 = \`__7__\${key1}__\`;
            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 = \`ChildWidget\`;
                let W6 = context.constructor.components[componentKey6] || QWeb.components[componentKey6]|| scope['ChildWidget'];
                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;
        }
    }
    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[`composition t-ref on a node, and t-on-click 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    context.__owl__.refs = context.__owl__.refs || {};
    let h = this.h;
    let c4 = [], p4 = {key:4};
    let vn4 = h('div', p4, c4);
    const ref5 = \`nibor\`;
    p4.hook = {
      create: (_, n) => {
        context.__owl__.refs[ref5] = n.elm;
      },
      destroy: () => {
        delete context.__owl__.refs[ref5];
      },
    };
    c4.push({text: \`nibor\`});
    return vn4;
}"
`;

exports[`composition t-ref on a node, and t-on-click 2`] = `
"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 = {};
    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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('click', function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['doSomething'](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[`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 slot setted value (with t-set) not accessible with t-esc 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);
    scope.iter = 'source';
    let c2 = [], p2 = {key:2};
    let vn2 = h('p', p2, c2);
    c1.push(vn2);
    if (scope.iter != null) {
        c2.push({text: scope.iter});
    }
    // Component 'ChildWidget'
    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, Object.assign(Object.create(context), scope));
        let pvnode = w3.__owl__.pvnode;
        c1.push(pvnode);
    } else {
        let componentKey3 = \`ChildWidget\`;
        let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| scope['ChildWidget'];
        if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
        w3 = new W3(parent, props3);
        parent.__owl__.cmap['__4__'] = w3.__owl__.id;
        w3.__owl__.slotId = 1;
        let fiber = w3.__prepare(extra.fiber, Object.assign(Object.create(context), scope), () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
        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;
    let c6 = [], p6 = {key:6};
    let vn6 = h('p', p6, c6);
    c1.push(vn6);
    if (scope.iter != null) {
        c6.push({text: scope.iter});
    }
    return vn1;
}"
`;

exports[`other directives with t-component t-on expression captured in t-foreach 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    scope.iter = 0;
    let _2 = scope['arr'];
    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.create(scope);
    for (let i1 = 0; i1 < _length3; i1++) {
        scope.val_first = i1 === 0
        scope.val_last = i1 === _length3 - 1
        scope.val_index = i1
        scope.val = _3[i1]
        scope.val_value = _4[i1]
        let key1 = scope['val'];
        let c6 = [], p6 = {key:\`\${key1}_6\`};
        let vn6 = h('div', p6, c6);
        c1.push(vn6);
        let c7 = [], p7 = {key:\`\${key1}_7\`,on:{}};
        let vn7 = h('button', p7, c7);
        c6.push(vn7);
        const otherState_8 = scope['otherState'];
        const iter_8 = scope.iter;
        p7.on['click'] = function (e) {if (context.__owl__.status === 5){return}otherState_8.vals.push(iter_8+'_'+iter_8)};
        c7.push({text: \`expr\`});
        utils.getScope(scope, 'iter').iter = scope.iter+1;
    }
    scope = _origScope5;
    return vn1;
}"
`;

exports[`other directives with t-component t-on expression in 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'].values;
    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.create(scope);
    for (let i1 = 0; i1 < _length3; i1++) {
        scope.val_first = i1 === 0
        scope.val_last = i1 === _length3 - 1
        scope.val_index = i1
        scope.val = _3[i1]
        scope.val_value = _4[i1]
        let key1 = scope['val'];
        let c6 = [], p6 = {key:\`\${key1}_6\`};
        let vn6 = h('div', p6, c6);
        c1.push(vn6);
        let _7 = scope['val_index'];
        if (_7 != null) {
            c6.push({text: _7});
        }
        c6.push({text: \`: \`});
        let _8 = scope['val']+'';
        if (_8 != null) {
            c6.push({text: _8});
        }
        let c9 = [], p9 = {key:\`\${key1}_9\`,on:{}};
        let vn9 = h('button', p9, c9);
        c6.push(vn9);
        const otherState_10 = scope['otherState'];
        const val_10 = scope['val'];
        p9.on['click'] = function (e) {if (context.__owl__.status === 5){return}otherState_10.vals.push(val_10)};
        c9.push({text: \`Expr\`});
    }
    scope = _origScope5;
    return vn1;
}"
`;

exports[`other directives with t-component t-on expression in t-foreach with t-set 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    scope.bossa = 'nova';
    let _2 = scope['state'].values;
    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.create(scope);
    for (let i1 = 0; i1 < _length3; i1++) {
        scope.val_first = i1 === 0
        scope.val_last = i1 === _length3 - 1
        scope.val_index = i1
        scope.val = _3[i1]
        scope.val_value = _4[i1]
        let key1 = scope['val'];
        let c6 = [], p6 = {key:\`\${key1}_6\`};
        let vn6 = h('div', p6, c6);
        c1.push(vn6);
        utils.getScope(scope, 'bossa').bossa = scope.bossa+'_'+scope['val_index'];
        let _7 = scope['val_index'];
        if (_7 != null) {
            c6.push({text: _7});
        }
        c6.push({text: \`: \`});
        let _8 = scope['val']+'';
        if (_8 != null) {
            c6.push({text: _8});
        }
        let c9 = [], p9 = {key:\`\${key1}_9\`,on:{}};
        let vn9 = h('button', p9, c9);
        c6.push(vn9);
        const otherState_10 = scope['otherState'];
        const val_10 = scope['val'];
        const bossa_10 = scope.bossa;
        p9.on['click'] = function (e) {if (context.__owl__.status === 5){return}otherState_10.vals.push(val_10+'_'+bossa_10)};
        c9.push({text: \`Expr\`});
    }
    scope = _origScope5;
    return vn1;
}"
`;

exports[`other directives with t-component t-on method call in t-foreach 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    let _2 = scope['state'].values;
    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.create(scope);
    for (let i1 = 0; i1 < _length3; i1++) {
        scope.val_first = i1 === 0
        scope.val_last = i1 === _length3 - 1
        scope.val_index = i1
        scope.val = _3[i1]
        scope.val_value = _4[i1]
        let key1 = scope['val'];
        let c6 = [], p6 = {key:\`\${key1}_6\`};
        let vn6 = h('div', p6, c6);
        c1.push(vn6);
        let _7 = scope['val_index'];
        if (_7 != null) {
            c6.push({text: _7});
        }
        c6.push({text: \`: \`});
        let _8 = scope['val']+'';
        if (_8 != null) {
            c6.push({text: _8});
        }
        let c9 = [], p9 = {key:\`\${key1}_9\`,on:{}};
        let vn9 = h('button', p9, c9);
        c6.push(vn9);
        let args10 = [scope['val']];
        p9.on['click'] = function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['addVal'](...args10, e);};
        c9.push({text: \`meth call\`});
    }
    scope = _origScope5;
    return vn1;
}"
`;

exports[`other directives with t-component t-on with .capture modifier 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 = {};
    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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('click', function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['capture'](e);}, true);}});});
        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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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'
    const state_5 = scope['state'];
    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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){return}state_5.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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev-1', function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['onEv1'](e);});vn.elm.addEventListener('ev-2', function (e) {if (context.__owl__.status === 5){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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev-1', function (e) {if (context.__owl__.status === 5){return}e.stopPropagation();utils.getComponent(context)['onEv1'](e);});vn.elm.addEventListener('ev-2', function (e) {if (context.__owl__.status === 5){return}e.preventDefault();utils.getComponent(context)['onEv2'](e);});vn.elm.addEventListener('ev-3', function (e) {if (context.__owl__.status === 5){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[`other directives with t-component t-set can't alter component 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};
    let vn2 = h('p', p2, c2);
    c1.push(vn2);
    let _3 = scope['iter'];
    if (_3 != null) {
        c2.push({text: _3});
    }
    scope.iter = 5;
    let c4 = [], p4 = {key:4};
    let vn4 = h('p', p4, c4);
    c1.push(vn4);
    if (scope.iter != null) {
        c4.push({text: scope.iter});
    }
    return vn1;
}"
`;

exports[`other directives with t-component t-set can't alter from within callee 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    scope.iter = 'source';
    let c2 = [], p2 = {key:2};
    let vn2 = h('p', p2, c2);
    c1.push(vn2);
    if (scope.iter != null) {
        c2.push({text: scope.iter});
    }
    let _origScope6 = scope;
    scope = Object.create(scope);
    scope.__access_mode__ = 'ro';
    this.constructor.subTemplates['2'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__7__'}));
    scope = _origScope6;
    let c8 = [], p8 = {key:8};
    let vn8 = h('p', p8, c8);
    c1.push(vn8);
    if (scope.iter != null) {
        c8.push({text: scope.iter});
    }
    return vn1;
}"
`;

exports[`other directives with t-component t-set can't alter in t-call body 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    scope.iter = 'source';
    let c2 = [], p2 = {key:2};
    let vn2 = h('p', p2, c2);
    c1.push(vn2);
    if (scope.iter != null) {
        c2.push({text: scope.iter});
    }
    let _origScope6 = scope;
    scope = Object.create(scope);
    scope.__access_mode__ = 'ro';
    {
        {
            let c__0 = [];
            utils.getScope(scope, 'iter').iter = 'inCall';
            scope[utils.zero] = c__0;
        }
        this.constructor.subTemplates['2'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__7__'}));
    }
    scope = _origScope6;
    let c8 = [], p8 = {key:8};
    let vn8 = h('p', p8, c8);
    c1.push(vn8);
    if (scope.iter != null) {
        c8.push({text: scope.iter});
    }
    return vn1;
}"
`;

exports[`other directives with t-component t-set not altered by child widget 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);
    scope.iter = 'source';
    let c2 = [], p2 = {key:2};
    let vn2 = h('p', p2, c2);
    c1.push(vn2);
    if (scope.iter != null) {
        c2.push({text: scope.iter});
    }
    // Component 'ChildWidget'
    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 = \`ChildWidget\`;
        let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| scope['ChildWidget'];
        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; });
        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;
    let c5 = [], p5 = {key:5};
    let vn5 = h('p', p5, c5);
    c1.push(vn5);
    if (scope.iter != null) {
        c5.push({text: scope.iter});
    }
    return vn1;
}"
`;

exports[`other directives with t-component t-set outside modified in t-foreach 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    scope.iter = 0;
    let _2 = scope['state'].values;
    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.create(scope);
    for (let i1 = 0; i1 < _length3; i1++) {
        scope.val_first = i1 === 0
        scope.val_last = i1 === _length3 - 1
        scope.val_index = i1
        scope.val = _3[i1]
        scope.val_value = _4[i1]
        let key1 = scope['val'];
        let c6 = [], p6 = {key:\`\${key1}_6\`};
        let vn6 = h('p', p6, c6);
        c1.push(vn6);
        c6.push({text: \`InLoop: \`});
        if (scope.iter != null) {
            c6.push({text: scope.iter});
        }
        utils.getScope(scope, 'iter').iter = scope.iter+1;
    }
    scope = _origScope5;
    let c7 = [], p7 = {key:7};
    let vn7 = h('p', p7, c7);
    c1.push(vn7);
    c7.push({text: \`EndLoop: \`});
    if (scope.iter != null) {
        c7.push({text: scope.iter});
    }
    return vn1;
}"
`;

exports[`props evaluation  t-set with a body expression can be used as textual prop 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 c2 = new utils.VDomArray();
    c2.push({text: \`42\`});
    scope.abc = c2
    // Component 'Child'
    let w3 = '__4__' in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap['__4__']] : false;
    let props3 = {val:scope.abc};
    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; });
        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[`random stuff/miscellaneous can inject values in tagged templates 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__2\\"
    let utils = this.constructor.utils;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = [], p1 = {key:1};
    let vn1 = h('div', p1, c1);
    let _origScope5 = scope;
    scope = Object.create(scope);
    scope.__access_mode__ = 'ro';
    this.constructor.subTemplates['3'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__6__'}));
    scope = _origScope5;
    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);
    {
        let key0 = 'somestring';
        // Component 'child'
        let k3 = \`__3__\${key0}__\`;
        let w2 = k3 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k3]] : false;
        let props2 = {flag:scope['state'].flag};
        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[`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.create(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]
        let key1 = i1;
        {
            let key1 = scope['item'];
            // Component 'Child'
            let k7 = \`__7__\${key1}__\`;
            let args8 = [scope['item']];
            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; utils.assignHooks(vnode.data, {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['onEv'](...args8, e);});}});});
                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;
        }
    }
    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 c2 = extra.parentNode;
    let key0 = extra.key || \\"\\";
    let c3 = [], p3 = {key:\`\${key0}_3\`,on:{}};
    let vn3 = h('p', p3, c3);
    c2.push(vn3);
    let k4 = \`click__4__\${key0}__\`;
    extra.handlers[k4] = extra.handlers[k4] || function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['update'](e);};
    p3.on['click'] = extra.handlers[k4];
    c3.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 c2 = extra.parentNode;
    let key0 = extra.key || \\"\\";
    let c3 = [], p3 = {key:\`\${key0}_3\`,on:{}};
    let vn3 = h('p', p3, c3);
    c2.push(vn3);
    let args4 = [scope['a']];
    p3.on['click'] = function (e) {if (context.__owl__.status === 5){return}utils.getComponent(context)['update'](...args4, e);};
    c3.push({text: \`lucas\`});
}"
`;

exports[`t-call parent is set within t-call 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"sub\\"
    let utils = this.constructor.utils;
    let QWeb = this.constructor;
    let parent = extra.parent;
    let scope = Object.create(context);
    let h = this.h;
    let c2 = extra.parentNode;
    let key0 = extra.key || \\"\\";
    // Component 'Child'
    let k4 = \`__4__\${key0}__\`;
    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;
        c2.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();}}});
        c2.push(pvnode);
        w3.__owl__.pvnode = pvnode;
    }
    w3.__owl__.parentLastFiberId = extra.fiber.id;
}"
`;

exports[`t-call parent is set within t-call with no parentNode 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"sub\\"
    let utils = this.constructor.utils;
    let QWeb = this.constructor;
    let parent = extra.parent;
    let scope = Object.create(context);
    let h = this.h;
    let c1 = extra.parentNode;
    let key0 = extra.key || \\"\\";
    // Component 'Child'
    let k3 = \`__3__\${key0}__\`;
    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; });
        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;
}"
`;

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 an input with bracket expression 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'];
    let exprKey2 = 'text';
    p2.props = {value: expr2[exprKey2]};
    extra.handlers['__3__'] = extra.handlers['__3__'] || ((ev) => {expr2[exprKey2] = 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.create(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]
        let key1 = scope['thing'].id;
        let _6 = 'checkbox';
        let c7 = [], p7 = {key:\`\${key1}_7\`,attrs:{type: _6},on:{}};
        let vn7 = h('input', p7, c7);
        c1.push(vn7);
        let expr7 = scope['thing'];
        let k8 = \`__8__\${key1}__\`;
        p7.props = {checked: expr7.f};
        extra.handlers[k8] = extra.handlers[k8] || ((ev) => {expr7.f = ev.target.checked});
        p7.on['input'] = extra.handlers[k8];
    }
    scope = _origScope5;
    return vn1;
}"
`;

exports[`t-model directive in a t-foreach, part 2 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.create(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]
        let key1 = scope['thing_index'];
        let c6 = [], p6 = {key:\`\${key1}_6\`,on:{}};
        let vn6 = h('input', p6, c6);
        c1.push(vn6);
        let expr6 = scope['state'];
        let exprKey6 = scope['thing_index'];
        let k7 = \`__7__\${key1}__\`;
        p6.props = {value: expr6[exprKey6]};
        extra.handlers[k7] = extra.handlers[k7] || ((ev) => {expr6[exprKey6] = ev.target.value});
        p6.on['input'] = extra.handlers[k7];
    }
    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},props:{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},props:{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[`t-model directive two inputs in a div with a t-key 1`] = `
"function anonymous(context, extra
) {
    // Template name: \\"__template__1\\"
    let scope = Object.create(context);
    let result;
    let h = this.h;
    {
        let key0 = 'key';
        let c1 = [], p1 = {key:\`\${key0}_1\`};
        let vn1 = h('div', p1, c1);
        result = vn1;
        result = vn1;
        if (scope['state'].flag) {
            let _3 = {'a':true};
            let c4 = [], p4 = {key:\`\${key0}_4\`,class:_3};
            let vn4 = h('input', p4, c4);
            c1.push(vn4);
        }
        if (!scope['state'].flag) {
            let _6 = {'b':true};
            let c7 = [], p7 = {key:\`\${key0}_7\`,class:_6};
            let vn7 = h('input', p7, c7);
            c1.push(vn7);
        }
    }
    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;
    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;
}"
`;
