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

exports[`class and style attributes with t-widget dynamic t-att-style is properly added and updated on widget root el 1`] = `
"function anonymous(context,extra
) {
    let owner = context;
    var h = this.utils.h;
    var c1 = [], p1 = {key:1};
    var vn1 = h('div', p1, c1);
    //WIDGET
    let _2_index = c1.length;
    c1.push(null);
    let def3;
    let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
    let props4 = {};
    let isNew4 = !w4;
    if (w4 && w4.__owl__.renderPromise) {
        if (w4.__owl__.isStarted) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            isNew4 = true
            if (props4 === w4.__owl__.renderProps) {
                def3 = w4.__owl__.renderPromise;
            } else {
                w4.destroy();
                w4 = false
            }
        }
    }
    if (!def3) {
        if (w4) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            w4 = new context.widgets['child'](owner, props4);
            context.__owl__.cmap[4] = w4.__owl__.id;
            def3 = w4._prepare();
        }
    }
    const _5 = context['state'].style;
    if (isNew4) {
        def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.style = _5}};let pvnode=h(vnode.sel, {key: 4});c1[_2_index]=pvnode;pvnode.data.hook = {insert(vn){let nvn=w4._mount(vnode, vn.elm);pvnode.elm=nvn.elm;},remove(){w4.destroy()},destroy(){w4.destroy()}}; w4.__owl__.pvnode = pvnode;});
    } else {
        def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};w4.el.style=_5;let vnode;if (!w4.__owl__.vnode){vnode=w4.__owl__.pvnode} else { vnode=h(w4.__owl__.vnode.sel, {key: 4});vnode.elm=w4.el;vnode.data.hook = {insert(a){a.elm.parentNode.replaceChild(w4.el,a.elm);a.elm=w4.el;w4.__mount();},remove(){w4.destroy()}, destroy() {w4.destroy()}}}c1[_2_index]=vnode;});
    }
    extra.promises.push(def3);
    return vn1;
}"
`;

exports[`class and style attributes with t-widget t-att-class is properly added/removed on widget root el 1`] = `
"function anonymous(context,extra
) {
    let owner = context;
    var h = this.utils.h;
    var c1 = [], p1 = {key:1};
    var vn1 = h('div', p1, c1);
    //WIDGET
    let _2_index = c1.length;
    c1.push(null);
    let def3;
    let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
    let props4 = {};
    let isNew4 = !w4;
    if (w4 && w4.__owl__.renderPromise) {
        if (w4.__owl__.isStarted) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            isNew4 = true
            if (props4 === w4.__owl__.renderProps) {
                def3 = w4.__owl__.renderPromise;
            } else {
                w4.destroy();
                w4 = false
            }
        }
    }
    if (!def3) {
        if (w4) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            w4 = new context.widgets['child'](owner, props4);
            context.__owl__.cmap[4] = w4.__owl__.id;
            def3 = w4._prepare();
        }
    }
    const _5 = {a: context['state'].a,b: context['state'].b};
    if (isNew4) {
        def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){for (let k in _5) {
              if (_5[k]) {
                  vn.elm.classList.add(k);
              }
          }}};let pvnode=h(vnode.sel, {key: 4});c1[_2_index]=pvnode;pvnode.data.hook = {insert(vn){let nvn=w4._mount(vnode, vn.elm);pvnode.elm=nvn.elm;},remove(){w4.destroy()},destroy(){w4.destroy()}}; w4.__owl__.pvnode = pvnode;});
    } else {
        def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let cl=w4.el.classList;for (let k in _5) {if (_5[k]) {cl.add(k)} else {cl.remove(k)}}let vnode;if (!w4.__owl__.vnode){vnode=w4.__owl__.pvnode} else { vnode=h(w4.__owl__.vnode.sel, {key: 4});vnode.elm=w4.el;vnode.data.hook = {insert(a){a.elm.parentNode.replaceChild(w4.el,a.elm);a.elm=w4.el;w4.__mount();},remove(){w4.destroy()}, destroy() {w4.destroy()}}}c1[_2_index]=vnode;});
    }
    extra.promises.push(def3);
    return vn1;
}"
`;

exports[`composition sub widgets with some state rendered in a loop 1`] = `
"function anonymous(context,extra
) {
    let owner = context;
    context = Object.create(context);
    var h = this.utils.h;
    var c1 = [], p1 = {key:1};
    var vn1 = h('div', p1, c1);
    var _2 = context['state'].numbers;
    if (!_2) { throw new Error('QWeb error: Invalid loop expression')}
    if (typeof _2 === 'number') { _2 = Array.from(Array(_2).keys())}
    var _3 = _2 instanceof Array ? _2 : Object.keys(_2);
    var _4 = _2 instanceof Array ? _2 : Object.values(_2);
    for (let i = 0; i < _3.length; i++) {
        context.number_first = i === 0;
        context.number_last = i === _3.length - 1;
        context.number_parity = i % 2 === 0 ? 'even' : 'odd';
        context.number_index = i;
        context.number = _3[i];
        context.number_value = _4[i];
        //WIDGET
        let key8 = context['number'];
        let _5_index = c1.length;
        c1.push(null);
        let def6;
        let w7 = key8 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[key8]] : false;
        let props7 = {};
        let isNew7 = !w7;
        if (w7 && w7.__owl__.renderPromise) {
            if (w7.__owl__.isStarted) {
                def6 = w7._updateProps(props7, extra.forceUpdate, extra.patchQueue);
            } else {
                isNew7 = true
                if (props7 === w7.__owl__.renderProps) {
                    def6 = w7.__owl__.renderPromise;
                } else {
                    w7.destroy();
                    w7 = false
                }
            }
        }
        if (!def6) {
            if (w7) {
                def6 = w7._updateProps(props7, extra.forceUpdate, extra.patchQueue);
            } else {
                w7 = new context.widgets['ChildWidget'](owner, props7);
                context.__owl__.cmap[key8] = w7.__owl__.id;
                def6 = w7._prepare();
            }
        }
        if (isNew7) {
            def6 = def6.then(vnode=>{let pvnode=h(vnode.sel, {key: key8});c1[_5_index]=pvnode;pvnode.data.hook = {insert(vn){let nvn=w7._mount(vnode, vn.elm);pvnode.elm=nvn.elm;},remove(){w7.destroy()},destroy(){w7.destroy()}}; w7.__owl__.pvnode = pvnode;});
        } else {
            def6 = def6.then(()=>{if (w7.__owl__.isDestroyed) {return};let vnode;if (!w7.__owl__.vnode){vnode=w7.__owl__.pvnode} else { vnode=h(w7.__owl__.vnode.sel, {key: key8});vnode.elm=w7.el;vnode.data.hook = {insert(a){a.elm.parentNode.replaceChild(w7.el,a.elm);a.elm=w7.el;w7.__mount();},remove(){w7.destroy()}, destroy() {w7.destroy()}}}c1[_5_index]=vnode;});
        }
        extra.promises.push(def6);
    }
    return vn1;
}"
`;

exports[`random stuff/miscellaneous snapshotting compiled code 1`] = `
"function anonymous(context,extra
) {
    let owner = context;
    var h = this.utils.h;
    var c1 = [], p1 = {key:1};
    var vn1 = h('div', p1, c1);
    //WIDGET
    let key5 = 'somestring';
    let _2_index = c1.length;
    c1.push(null);
    let def3;
    let w4 = key5 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[key5]] : false;
    let props4 = {flag: context['state'].flag};
    let isNew4 = !w4;
    if (w4 && w4.__owl__.renderPromise) {
        if (w4.__owl__.isStarted) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            isNew4 = true
            if (props4 === w4.__owl__.renderProps) {
                def3 = w4.__owl__.renderPromise;
            } else {
                w4.destroy();
                w4 = false
            }
        }
    }
    if (!def3) {
        if (w4) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            w4 = new context.widgets['child'](owner, props4);
            context.__owl__.cmap[key5] = w4.__owl__.id;
            def3 = w4._prepare();
        }
    }
    if (isNew4) {
        def3 = def3.then(vnode=>{let pvnode=h(vnode.sel, {key: key5});c1[_2_index]=pvnode;pvnode.data.hook = {insert(vn){let nvn=w4._mount(vnode, vn.elm);pvnode.elm=nvn.elm;},remove(){w4.destroy()},destroy(){w4.destroy()}}; w4.__owl__.pvnode = pvnode;});
    } else {
        def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let vnode;if (!w4.__owl__.vnode){vnode=w4.__owl__.pvnode} else { vnode=h(w4.__owl__.vnode.sel, {key: key5});vnode.elm=w4.el;vnode.data.hook = {insert(a){a.elm.parentNode.replaceChild(w4.el,a.elm);a.elm=w4.el;w4.__mount();},remove(){w4.destroy()}, destroy() {w4.destroy()}}}c1[_2_index]=vnode;});
    }
    extra.promises.push(def3);
    return vn1;
}"
`;

exports[`random stuff/miscellaneous t-props should not be undefined (snapshotting) 1`] = `
"function anonymous(context,extra
) {
    let owner = context;
    var h = this.utils.h;
    var c1 = [], p1 = {key:1};
    var vn1 = h('div', p1, c1);
    //WIDGET
    let _2_index = c1.length;
    c1.push(null);
    let def3;
    let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
    let props4 = {};
    let isNew4 = !w4;
    if (w4 && w4.__owl__.renderPromise) {
        if (w4.__owl__.isStarted) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            isNew4 = true
            if (props4 === w4.__owl__.renderProps) {
                def3 = w4.__owl__.renderPromise;
            } else {
                w4.destroy();
                w4 = false
            }
        }
    }
    if (!def3) {
        if (w4) {
            def3 = w4._updateProps(props4, extra.forceUpdate, extra.patchQueue);
        } else {
            w4 = new context.widgets['child'](owner, props4);
            context.__owl__.cmap[4] = w4.__owl__.id;
            def3 = w4._prepare();
        }
    }
    if (isNew4) {
        def3 = def3.then(vnode=>{let pvnode=h(vnode.sel, {key: 4});c1[_2_index]=pvnode;pvnode.data.hook = {insert(vn){let nvn=w4._mount(vnode, vn.elm);pvnode.elm=nvn.elm;},remove(){w4.destroy()},destroy(){w4.destroy()}}; w4.__owl__.pvnode = pvnode;});
    } else {
        def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let vnode;if (!w4.__owl__.vnode){vnode=w4.__owl__.pvnode} else { vnode=h(w4.__owl__.vnode.sel, {key: 4});vnode.elm=w4.el;vnode.data.hook = {insert(a){a.elm.parentNode.replaceChild(w4.el,a.elm);a.elm=w4.el;w4.__mount();},remove(){w4.destroy()}, destroy() {w4.destroy()}}}c1[_2_index]=vnode;});
    }
    extra.promises.push(def3);
    return vn1;
}"
`;
