2019-02-14 12:37:07 +01:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
2019-06-18 09:24:52 +02:00
|
|
|
exports[`async rendering delayed component with t-asyncroot directive 1`] = `
|
2019-06-14 10:17:13 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
|
|
|
var vn2 = h('button', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
if (!context['updateApp']) {
|
|
|
|
|
throw new Error('Missing handler \\\\'' + 'updateApp' + \`\\\\' when evaluating template 'Parent'\`)
|
|
|
|
|
}
|
|
|
|
|
extra.handlers['click' + 2] = extra.handlers['click' + 2] || context['updateApp'].bind(owner);
|
|
|
|
|
p2.on['click'] = extra.handlers['click' + 2];
|
|
|
|
|
c2.push({text: \`Update App State\`});
|
2019-06-25 14:24:03 +02:00
|
|
|
let _4 = {'children':true};
|
|
|
|
|
let c5 = [], p5 = {key:5,class:_4};
|
|
|
|
|
var vn5 = h('div', p5, c5);
|
|
|
|
|
c1.push(vn5);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-25 14:24:03 +02:00
|
|
|
let def7;
|
|
|
|
|
let w8 = 8 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[8]] : false;
|
|
|
|
|
let _6_index = c5.length;
|
|
|
|
|
c5.push(null);
|
|
|
|
|
let props8 = {val:context['state'].val};
|
|
|
|
|
if (w8 && w8.__owl__.renderPromise && !w8.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props8, w8.__owl__.renderProps)) {
|
|
|
|
|
def7 = w8.__owl__.renderPromise;
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
w8.destroy();
|
|
|
|
|
w8 = false;
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
if (!w8) {
|
|
|
|
|
let componentKey8 = \`Child\`;
|
|
|
|
|
let W8 = context.components && context.components[componentKey8] || QWeb.components[componentKey8];
|
|
|
|
|
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
|
|
|
|
|
w8 = new W8(owner, props8);
|
|
|
|
|
context.__owl__.cmap[8] = w8.__owl__.id;
|
|
|
|
|
def7 = w8.__prepare();
|
|
|
|
|
def7 = def7.then(vnode=>{let pvnode=h(vnode.sel, {key: 8, hook: {insert(vn) {let nvn=w8.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w8.destroy();}}});c5[_6_index]=pvnode;w8.__owl__.pvnode = pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
def7 = def7 || w8.__updateProps(props8, extra.forceUpdate, extra.patchQueue);
|
|
|
|
|
def7 = def7.then(()=>{if (w8.__owl__.isDestroyed) {return};let pvnode=w8.__owl__.pvnode;c5[_6_index]=pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
extra.promises.push(def7);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-25 14:24:03 +02:00
|
|
|
let def10;
|
|
|
|
|
let w11 = 11 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[11]] : false;
|
|
|
|
|
let _9_index = c5.length;
|
|
|
|
|
const patchQueue11 = [];
|
|
|
|
|
c5.push(w11 && w11.__owl__.pvnode || null);
|
|
|
|
|
let props11 = {val:context['state'].val};
|
|
|
|
|
if (w11 && w11.__owl__.renderPromise && !w11.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props11, w11.__owl__.renderProps)) {
|
|
|
|
|
def10 = w11.__owl__.renderPromise;
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
w11.destroy();
|
|
|
|
|
w11 = false;
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
if (!w11) {
|
|
|
|
|
let componentKey11 = \`AsyncChild\`;
|
|
|
|
|
let W11 = context.components && context.components[componentKey11] || QWeb.components[componentKey11];
|
|
|
|
|
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
|
|
|
|
|
w11 = new W11(owner, props11);
|
|
|
|
|
context.__owl__.cmap[11] = w11.__owl__.id;
|
|
|
|
|
def10 = w11.__prepare();
|
|
|
|
|
def10 = def10.then(vnode=>{let pvnode=h(vnode.sel, {key: 11, hook: {insert(vn) {let nvn=w11.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w11.destroy();}}});c5[_9_index]=pvnode;w11.__owl__.pvnode = pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
def10 = def10 || w11.__updateProps(props11, extra.forceUpdate, patchQueue11);
|
|
|
|
|
def10 = def10.then(()=>{if (w11.__owl__.isDestroyed) {return};let pvnode=w11.__owl__.pvnode;c5[_9_index]=pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
def10.then(w11.__applyPatchQueue.bind(w11, patchQueue11));
|
2019-06-14 10:17:13 +02:00
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-18 09:24:52 +02:00
|
|
|
exports[`async rendering fast component with t-asyncroot directive 1`] = `
|
2019-06-14 10:17:13 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
|
|
|
var vn2 = h('button', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
if (!context['updateApp']) {
|
|
|
|
|
throw new Error('Missing handler \\\\'' + 'updateApp' + \`\\\\' when evaluating template 'Parent'\`)
|
|
|
|
|
}
|
|
|
|
|
extra.handlers['click' + 2] = extra.handlers['click' + 2] || context['updateApp'].bind(owner);
|
|
|
|
|
p2.on['click'] = extra.handlers['click' + 2];
|
|
|
|
|
c2.push({text: \`Update App State\`});
|
2019-06-25 14:24:03 +02:00
|
|
|
let _4 = {'children':true};
|
|
|
|
|
let c5 = [], p5 = {key:5,class:_4};
|
|
|
|
|
var vn5 = h('div', p5, c5);
|
|
|
|
|
c1.push(vn5);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-25 14:24:03 +02:00
|
|
|
let def7;
|
|
|
|
|
let w8 = 8 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[8]] : false;
|
|
|
|
|
let _6_index = c5.length;
|
|
|
|
|
const patchQueue8 = [];
|
|
|
|
|
c5.push(w8 && w8.__owl__.pvnode || null);
|
|
|
|
|
let props8 = {val:context['state'].val};
|
|
|
|
|
if (w8 && w8.__owl__.renderPromise && !w8.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props8, w8.__owl__.renderProps)) {
|
|
|
|
|
def7 = w8.__owl__.renderPromise;
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
w8.destroy();
|
|
|
|
|
w8 = false;
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
if (!w8) {
|
|
|
|
|
let componentKey8 = \`Child\`;
|
|
|
|
|
let W8 = context.components && context.components[componentKey8] || QWeb.components[componentKey8];
|
|
|
|
|
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
|
|
|
|
|
w8 = new W8(owner, props8);
|
|
|
|
|
context.__owl__.cmap[8] = w8.__owl__.id;
|
|
|
|
|
def7 = w8.__prepare();
|
|
|
|
|
def7 = def7.then(vnode=>{let pvnode=h(vnode.sel, {key: 8, hook: {insert(vn) {let nvn=w8.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w8.destroy();}}});c5[_6_index]=pvnode;w8.__owl__.pvnode = pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
def7 = def7 || w8.__updateProps(props8, extra.forceUpdate, patchQueue8);
|
|
|
|
|
def7 = def7.then(()=>{if (w8.__owl__.isDestroyed) {return};let pvnode=w8.__owl__.pvnode;c5[_6_index]=pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
def7.then(w8.__applyPatchQueue.bind(w8, patchQueue8));
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-25 14:24:03 +02:00
|
|
|
let def10;
|
|
|
|
|
let w11 = 11 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[11]] : false;
|
|
|
|
|
let _9_index = c5.length;
|
|
|
|
|
c5.push(null);
|
|
|
|
|
let props11 = {val:context['state'].val};
|
|
|
|
|
if (w11 && w11.__owl__.renderPromise && !w11.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props11, w11.__owl__.renderProps)) {
|
|
|
|
|
def10 = w11.__owl__.renderPromise;
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
w11.destroy();
|
|
|
|
|
w11 = false;
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
if (!w11) {
|
|
|
|
|
let componentKey11 = \`AsyncChild\`;
|
|
|
|
|
let W11 = context.components && context.components[componentKey11] || QWeb.components[componentKey11];
|
|
|
|
|
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
|
|
|
|
|
w11 = new W11(owner, props11);
|
|
|
|
|
context.__owl__.cmap[11] = w11.__owl__.id;
|
|
|
|
|
def10 = w11.__prepare();
|
|
|
|
|
def10 = def10.then(vnode=>{let pvnode=h(vnode.sel, {key: 11, hook: {insert(vn) {let nvn=w11.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w11.destroy();}}});c5[_9_index]=pvnode;w11.__owl__.pvnode = pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
def10 = def10 || w11.__updateProps(props11, extra.forceUpdate, extra.patchQueue);
|
|
|
|
|
def10 = def10.then(()=>{if (w11.__owl__.isDestroyed) {return};let pvnode=w11.__owl__.pvnode;c5[_9_index]=pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
extra.promises.push(def10);
|
2019-06-14 10:17:13 +02:00
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`async rendering t-component with t-asyncroot directive: mixed re-renderings 1`] = `
|
2019-06-14 10:17:13 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
|
|
|
var vn2 = h('button', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
if (!context['updateApp']) {
|
|
|
|
|
throw new Error('Missing handler \\\\'' + 'updateApp' + \`\\\\' when evaluating template 'Parent'\`)
|
|
|
|
|
}
|
|
|
|
|
extra.handlers['click' + 2] = extra.handlers['click' + 2] || context['updateApp'].bind(owner);
|
|
|
|
|
p2.on['click'] = extra.handlers['click' + 2];
|
|
|
|
|
c2.push({text: \`Update App State\`});
|
2019-06-25 14:24:03 +02:00
|
|
|
let _4 = {'children':true};
|
|
|
|
|
let c5 = [], p5 = {key:5,class:_4};
|
|
|
|
|
var vn5 = h('div', p5, c5);
|
|
|
|
|
c1.push(vn5);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-25 14:24:03 +02:00
|
|
|
let def7;
|
|
|
|
|
let w8 = 8 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[8]] : false;
|
|
|
|
|
let _6_index = c5.length;
|
|
|
|
|
c5.push(null);
|
|
|
|
|
let props8 = {val:context['state'].val};
|
|
|
|
|
if (w8 && w8.__owl__.renderPromise && !w8.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props8, w8.__owl__.renderProps)) {
|
|
|
|
|
def7 = w8.__owl__.renderPromise;
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
w8.destroy();
|
|
|
|
|
w8 = false;
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
if (!w8) {
|
|
|
|
|
let componentKey8 = \`Child\`;
|
|
|
|
|
let W8 = context.components && context.components[componentKey8] || QWeb.components[componentKey8];
|
|
|
|
|
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
|
|
|
|
|
w8 = new W8(owner, props8);
|
|
|
|
|
context.__owl__.cmap[8] = w8.__owl__.id;
|
|
|
|
|
def7 = w8.__prepare();
|
|
|
|
|
def7 = def7.then(vnode=>{let pvnode=h(vnode.sel, {key: 8, hook: {insert(vn) {let nvn=w8.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w8.destroy();}}});c5[_6_index]=pvnode;w8.__owl__.pvnode = pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
def7 = def7 || w8.__updateProps(props8, extra.forceUpdate, extra.patchQueue);
|
|
|
|
|
def7 = def7.then(()=>{if (w8.__owl__.isDestroyed) {return};let pvnode=w8.__owl__.pvnode;c5[_6_index]=pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
extra.promises.push(def7);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-25 14:24:03 +02:00
|
|
|
let def10;
|
|
|
|
|
let w11 = 11 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[11]] : false;
|
|
|
|
|
let _9_index = c5.length;
|
|
|
|
|
const patchQueue11 = [];
|
|
|
|
|
c5.push(w11 && w11.__owl__.pvnode || null);
|
|
|
|
|
let props11 = {val:context['state'].val};
|
|
|
|
|
if (w11 && w11.__owl__.renderPromise && !w11.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props11, w11.__owl__.renderProps)) {
|
|
|
|
|
def10 = w11.__owl__.renderPromise;
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
w11.destroy();
|
|
|
|
|
w11 = false;
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
if (!w11) {
|
|
|
|
|
let componentKey11 = \`AsyncChild\`;
|
|
|
|
|
let W11 = context.components && context.components[componentKey11] || QWeb.components[componentKey11];
|
|
|
|
|
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
|
|
|
|
|
w11 = new W11(owner, props11);
|
|
|
|
|
context.__owl__.cmap[11] = w11.__owl__.id;
|
|
|
|
|
def10 = w11.__prepare();
|
|
|
|
|
def10 = def10.then(vnode=>{let pvnode=h(vnode.sel, {key: 11, hook: {insert(vn) {let nvn=w11.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w11.destroy();}}});c5[_9_index]=pvnode;w11.__owl__.pvnode = pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
} else {
|
2019-06-25 14:24:03 +02:00
|
|
|
def10 = def10 || w11.__updateProps(props11, extra.forceUpdate, patchQueue11);
|
|
|
|
|
def10 = def10.then(()=>{if (w11.__owl__.isDestroyed) {return};let pvnode=w11.__owl__.pvnode;c5[_9_index]=pvnode;});
|
2019-06-14 10:17:13 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
def10.then(w11.__applyPatchQueue.bind(w11, patchQueue11));
|
2019-06-14 10:17:13 +02:00
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`class and style attributes with t-component dynamic t-att-style is properly added and updated on widget root el 1`] = `
|
2019-05-06 10:36:40 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
2019-05-20 10:45:26 +02:00
|
|
|
let utils = this.utils;
|
2019-05-23 16:14:52 +02:00
|
|
|
let QWeb = this.constructor;
|
2019-05-06 10:36:40 +02:00
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
2019-05-15 15:18:27 +02:00
|
|
|
let c1 = [], p1 = {key:1};
|
2019-05-06 10:36:40 +02:00
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-05-06 10:36:40 +02:00
|
|
|
let def3;
|
2019-05-16 14:51:24 +02:00
|
|
|
const _5 = context['state'].style;
|
2019-05-06 10:36:40 +02:00
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-05-06 10:36:40 +02:00
|
|
|
let props4 = {};
|
2019-06-01 21:44:43 +02:00
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
2019-05-06 10:36:40 +02:00
|
|
|
}
|
2019-05-16 22:56:10 +02:00
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-05-16 14:51:24 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.style = _5;}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-05-06 10:36:40 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-05-16 22:56:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};w4.el.style=_5;let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
2019-05-06 10:36:40 +02:00
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-25 14:24:03 +02:00
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v2) 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
//COMPONENT
|
|
|
|
|
let def3;
|
|
|
|
|
const ref5 = \`child\`;
|
|
|
|
|
let _6 = {'a':true};
|
|
|
|
|
Object.assign(_6, {b:context['state'].b})
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
|
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
|
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
|
|
|
|
let componentKey4 = \`Child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
|
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;context.refs[ref5] = w4;},remove() {},destroy(vn) {w4.destroy();delete context.refs[ref5];}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
|
|
|
} else {
|
|
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
|
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
w4.__owl__.classObj=_6;
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v2) 2`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let _2 = {'c':true};
|
|
|
|
|
Object.assign(_2, this.utils.toObj({d:context['state'].d}))
|
|
|
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
|
|
|
var vn3 = h('span', p3, c3);
|
|
|
|
|
return vn3;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v3) 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
//COMPONENT
|
|
|
|
|
let def3;
|
|
|
|
|
const ref5 = \`child\`;
|
|
|
|
|
let _6 = {'a':true};
|
2019-06-28 15:48:33 +02:00
|
|
|
Object.assign(_6, utils.toObj(context['state'].b?'b':''))
|
2019-06-25 14:24:03 +02:00
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
|
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
|
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
|
|
|
|
let componentKey4 = \`Child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
|
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
|
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;context.refs[ref5] = w4;},remove() {},destroy(vn) {w4.destroy();delete context.refs[ref5];}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
|
|
|
|
} else {
|
|
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
|
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
w4.__owl__.classObj=_6;
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el (v3) 2`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let _2 = {'c':true};
|
|
|
|
|
Object.assign(_2, this.utils.toObj(context['state'].d?'d':''))
|
|
|
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
|
|
|
var vn3 = h('span', p3, c3);
|
|
|
|
|
return vn3;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`class and style attributes with t-component t-att-class is properly added/removed on widget root el 1`] = `
|
2019-05-06 10:36:40 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
2019-05-20 10:45:26 +02:00
|
|
|
let utils = this.utils;
|
2019-05-23 16:14:52 +02:00
|
|
|
let QWeb = this.constructor;
|
2019-05-06 10:36:40 +02:00
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
2019-05-15 15:18:27 +02:00
|
|
|
let c1 = [], p1 = {key:1};
|
2019-05-06 10:36:40 +02:00
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-05-06 10:36:40 +02:00
|
|
|
let def3;
|
2019-06-25 14:24:03 +02:00
|
|
|
let _5 = {a:context['state'].a,b:context['state'].b};
|
2019-05-06 10:36:40 +02:00
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-05-06 10:36:40 +02:00
|
|
|
let props4 = {};
|
2019-06-01 21:44:43 +02:00
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
2019-05-06 10:36:40 +02:00
|
|
|
}
|
2019-05-16 22:56:10 +02:00
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-05-16 14:51:24 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
2019-06-25 14:24:03 +02:00
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-05-06 10:36:40 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-25 14:24:03 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
2019-05-06 10:36:40 +02:00
|
|
|
}
|
2019-06-25 14:24:03 +02:00
|
|
|
w4.__owl__.classObj=_5;
|
2019-05-06 10:36:40 +02:00
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`composition sub components with some state rendered in a loop 1`] = `
|
2019-03-13 14:10:15 +01:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
2019-05-20 10:45:26 +02:00
|
|
|
let utils = this.utils;
|
2019-05-23 16:14:52 +02:00
|
|
|
let QWeb = this.constructor;
|
2019-03-13 14:10:15 +01:00
|
|
|
let owner = context;
|
|
|
|
|
context = Object.create(context);
|
2019-04-04 14:08:38 +02:00
|
|
|
var h = this.utils.h;
|
2019-05-15 15:18:27 +02:00
|
|
|
let c1 = [], p1 = {key:1};
|
2019-04-04 14:08:38 +02:00
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
var _2 = context['state'].numbers;
|
2019-03-13 14:10:15 +01:00
|
|
|
if (!_2) { throw new Error('QWeb error: Invalid loop expression')}
|
2019-06-07 14:10:59 +02:00
|
|
|
var _3 = _4 = _2;
|
|
|
|
|
if (!(_2 instanceof Array)) {
|
|
|
|
|
_3 = Object.keys(_2);
|
|
|
|
|
_4 = Object.values(_2);
|
|
|
|
|
}
|
2019-05-28 14:04:08 +02:00
|
|
|
var _length3 = _3.length;
|
|
|
|
|
for (let i = 0; i < _length3; i++) {
|
2019-03-13 14:10:15 +01:00
|
|
|
context.number_first = i === 0;
|
2019-05-28 14:04:08 +02:00
|
|
|
context.number_last = i === _length3 - 1;
|
2019-03-13 14:10:15 +01:00
|
|
|
context.number_index = i;
|
|
|
|
|
context.number = _3[i];
|
|
|
|
|
context.number_value = _4[i];
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-03-13 14:10:15 +01:00
|
|
|
let key8 = context['number'];
|
|
|
|
|
let def6;
|
2019-04-13 14:14:34 +02:00
|
|
|
let w7 = key8 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[key8]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _5_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-03-29 12:39:00 +01:00
|
|
|
let props7 = {};
|
2019-06-01 21:44:43 +02:00
|
|
|
if (w7 && w7.__owl__.renderPromise && !w7.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props7, w7.__owl__.renderProps)) {
|
|
|
|
|
def6 = w7.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w7.destroy();
|
|
|
|
|
w7 = false;
|
|
|
|
|
}
|
2019-03-13 14:10:15 +01:00
|
|
|
}
|
2019-05-16 22:56:10 +02:00
|
|
|
if (!w7) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey7 = \`ChildWidget\`;
|
|
|
|
|
let W7 = context.components && context.components[componentKey7] || QWeb.components[componentKey7];
|
|
|
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
2019-05-16 14:51:24 +02:00
|
|
|
w7 = new W7(owner, props7);
|
|
|
|
|
context.__owl__.cmap[key8] = w7.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def6 = w7.__prepare();
|
|
|
|
|
def6 = def6.then(vnode=>{let pvnode=h(vnode.sel, {key: key8, hook: {insert(vn) {let nvn=w7.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w7.destroy();}}});c1[_5_index]=pvnode;w7.__owl__.pvnode = pvnode;});
|
2019-03-13 14:10:15 +01:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def6 = def6 || w7.__updateProps(props7, extra.forceUpdate, extra.patchQueue);
|
2019-05-16 22:56:10 +02:00
|
|
|
def6 = def6.then(()=>{if (w7.__owl__.isDestroyed) {return};let pvnode=w7.__owl__.pvnode;c1[_5_index]=pvnode;});
|
2019-03-13 14:10:15 +01:00
|
|
|
}
|
|
|
|
|
extra.promises.push(def6);
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`composition t-component with dynamic value 1`] = `
|
2019-05-28 14:30:08 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-05-28 14:30:08 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-05-28 14:30:08 +02:00
|
|
|
let props4 = {};
|
2019-06-01 21:44:43 +02:00
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
2019-05-28 14:30:08 +02:00
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = (context['state'].widget);
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-05-28 14:30:08 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-05-28 14:30:08 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-05-28 14:30:08 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`composition t-component with dynamic value 2 1`] = `
|
2019-05-28 14:30:08 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-05-28 14:30:08 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-05-28 14:30:08 +02:00
|
|
|
let props4 = {};
|
2019-06-01 21:44:43 +02:00
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
2019-05-28 14:30:08 +02:00
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`Widget\${context['state'].widget}\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-05-28 14:30:08 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 14:28:10 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 14:28:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
2019-06-03 15:12:21 +02:00
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with handler bound to argument 1`] = `
|
2019-06-03 15:12:21 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 15:12:21 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 15:12:21 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 15:12:21 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, 3));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 15:12:21 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 15:12:21 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with handler bound to empty object (with non empty inner string) 1`] = `
|
2019-06-03 15:12:21 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 15:12:21 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 15:12:21 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 15:12:21 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, {}));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 15:12:21 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 15:12:21 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with handler bound to empty object 1`] = `
|
2019-06-03 15:12:21 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 15:12:21 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 15:12:21 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 15:12:21 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, {}));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 15:12:21 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 15:12:21 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with handler bound to object 1`] = `
|
2019-06-03 15:12:21 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 15:12:21 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 15:12:21 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 15:12:21 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, {val:3}));}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 15:12:21 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 15:12:21 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
2019-06-03 14:28:10 +02:00
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with prevent and self modifiers (order matters) 1`] = `
|
2019-06-03 14:28:10 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 14:28:10 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 14:28:10 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`Child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 14:28:10 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {e.preventDefault();if (e.target !== vn.elm) {return}owner['onEv'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 14:28:10 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 14:28:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with self and prevent modifiers (order matters) 1`] = `
|
2019-06-03 14:28:10 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 14:28:10 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 14:28:10 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 14:28:10 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', function (e) {if (e.target !== vn.elm) {return}e.preventDefault();owner['onEv'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 14:28:10 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 14:28:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with self modifier 1`] = `
|
2019-06-03 14:28:10 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 14:28:10 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 14:28:10 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 14:28:10 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev-1', owner['onEv1'].bind(owner));vn.elm.addEventListener('ev-2', function (e) {if (e.target !== vn.elm) {return}owner['onEv2'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-03 14:28:10 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-03 14:28:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-20 09:42:33 +02:00
|
|
|
exports[`other directives with t-component t-on with stop and/or prevent modifiers 1`] = `
|
2019-06-03 14:28:10 +02:00
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-03 14:28:10 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 14:28:10 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-03 14:28:10 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev-1', function (e) {e.stopPropagation();owner['onEv1'].call(owner, e);});vn.elm.addEventListener('ev-2', function (e) {e.preventDefault();owner['onEv2'].call(owner, e);});vn.elm.addEventListener('ev-3', function (e) {e.stopPropagation();e.preventDefault();owner['onEv3'].call(owner, e);});}};let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-05-28 14:30:08 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-05-28 14:30:08 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-02-14 12:37:07 +01:00
|
|
|
exports[`random stuff/miscellaneous snapshotting compiled code 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
2019-05-20 10:45:26 +02:00
|
|
|
let utils = this.utils;
|
2019-05-23 16:14:52 +02:00
|
|
|
let QWeb = this.constructor;
|
2019-02-14 12:37:07 +01:00
|
|
|
let owner = context;
|
2019-04-04 14:08:38 +02:00
|
|
|
var h = this.utils.h;
|
2019-05-15 15:18:27 +02:00
|
|
|
let c1 = [], p1 = {key:1};
|
2019-04-04 14:08:38 +02:00
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-04-16 14:35:27 +02:00
|
|
|
let key5 = 'somestring';
|
2019-02-14 12:37:07 +01:00
|
|
|
let def3;
|
2019-04-13 14:14:34 +02:00
|
|
|
let w4 = key5 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[key5]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-03 10:10:41 +02:00
|
|
|
let props4 = {flag:context['state'].flag};
|
2019-06-01 21:44:43 +02:00
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
2019-02-14 12:37:07 +01:00
|
|
|
}
|
2019-05-16 22:56:10 +02:00
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`child\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-05-16 14:51:24 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[key5] = w4.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{let pvnode=h(vnode.sel, {key: key5, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-02-14 12:37:07 +01:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-05-16 22:56:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
2019-02-14 12:37:07 +01:00
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
2019-06-11 15:02:10 +02:00
|
|
|
|
2019-06-21 16:23:42 +02:00
|
|
|
exports[`random stuff/miscellaneous t-on with handler bound to dynamic argument on a t-foreach 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
context = Object.create(context);
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
var _2 = context['props'].items;
|
|
|
|
|
if (!_2) { throw new Error('QWeb error: Invalid loop expression')}
|
|
|
|
|
var _3 = _4 = _2;
|
|
|
|
|
if (!(_2 instanceof Array)) {
|
|
|
|
|
_3 = Object.keys(_2);
|
|
|
|
|
_4 = Object.values(_2);
|
|
|
|
|
}
|
|
|
|
|
var _length3 = _3.length;
|
|
|
|
|
for (let i = 0; i < _length3; i++) {
|
|
|
|
|
context.item_first = i === 0;
|
|
|
|
|
context.item_last = i === _length3 - 1;
|
|
|
|
|
context.item_index = i;
|
|
|
|
|
context.item = _3[i];
|
|
|
|
|
context.item_value = _4[i];
|
|
|
|
|
//COMPONENT
|
|
|
|
|
let key8 = context['item'];
|
|
|
|
|
let def6;
|
|
|
|
|
let arg9 = context['item'];
|
|
|
|
|
let w7 = key8 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[key8]] : false;
|
|
|
|
|
let _5_index = c1.length;
|
|
|
|
|
c1.push(null);
|
|
|
|
|
let props7 = {};
|
|
|
|
|
if (w7 && w7.__owl__.renderPromise && !w7.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props7, w7.__owl__.renderProps)) {
|
|
|
|
|
def6 = w7.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w7.destroy();
|
|
|
|
|
w7 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w7) {
|
|
|
|
|
let componentKey7 = \`Child\`;
|
|
|
|
|
let W7 = context.components && context.components[componentKey7] || QWeb.components[componentKey7];
|
|
|
|
|
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
|
|
|
|
|
w7 = new W7(owner, props7);
|
|
|
|
|
context.__owl__.cmap[key8] = w7.__owl__.id;
|
2019-06-24 13:02:12 +02:00
|
|
|
def6 = w7.__prepare();
|
|
|
|
|
def6 = def6.then(vnode=>{vnode.data.hook = {create(_, vn){vn.elm.addEventListener('ev', owner['onEv'].bind(owner, arg9));}};let pvnode=h(vnode.sel, {key: key8, hook: {insert(vn) {let nvn=w7.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w7.destroy();}}});c1[_5_index]=pvnode;w7.__owl__.pvnode = pvnode;});
|
2019-06-21 16:23:42 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def6 = def6 || w7.__updateProps(props7, extra.forceUpdate, extra.patchQueue);
|
2019-06-21 16:23:42 +02:00
|
|
|
def6 = def6.then(()=>{if (w7.__owl__.isDestroyed) {return};let pvnode=w7.__owl__.pvnode;c1[_5_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def6);
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-13 16:27:12 +02:00
|
|
|
exports[`t-model directive .lazy modifier 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
|
|
|
var vn2 = h('input', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
p2.props = {value: context.state['text']};
|
|
|
|
|
extra.handlers['change' + 2] = extra.handlers['change' + 2] || ((ev) => {context.state['text'] = ev.target.value});
|
|
|
|
|
p2.on['change'] = extra.handlers['change' + 2];
|
|
|
|
|
let c3 = [], p3 = {key:3};
|
|
|
|
|
var vn3 = h('span', p3, c3);
|
|
|
|
|
c1.push(vn3);
|
|
|
|
|
var _4 = context['state'].text;
|
|
|
|
|
if (_4 || _4 === 0) {
|
|
|
|
|
c3.push({text: _4});
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-model directive basic use, on an input 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
|
|
|
var vn2 = h('input', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
p2.props = {value: context.state['text']};
|
|
|
|
|
extra.handlers['input' + 2] = extra.handlers['input' + 2] || ((ev) => {context.state['text'] = ev.target.value});
|
|
|
|
|
p2.on['input'] = extra.handlers['input' + 2];
|
|
|
|
|
let c3 = [], p3 = {key:3};
|
|
|
|
|
var vn3 = h('span', p3, c3);
|
|
|
|
|
c1.push(vn3);
|
|
|
|
|
var _4 = context['state'].text;
|
|
|
|
|
if (_4 || _4 === 0) {
|
|
|
|
|
c3.push({text: _4});
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-model directive on a select 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
|
|
|
var vn2 = h('select', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
p2.props = {value: context.state['color']};
|
|
|
|
|
extra.handlers['change' + 2] = extra.handlers['change' + 2] || ((ev) => {context.state['color'] = ev.target.value});
|
|
|
|
|
p2.on['change'] = extra.handlers['change' + 2];
|
|
|
|
|
var _3 = '';
|
|
|
|
|
let c4 = [], p4 = {key:4,attrs:{value: _3}};
|
|
|
|
|
var vn4 = h('option', p4, c4);
|
|
|
|
|
c2.push(vn4);
|
|
|
|
|
c4.push({text: \`Please select one\`});
|
|
|
|
|
var _5 = 'red';
|
|
|
|
|
let c6 = [], p6 = {key:6,attrs:{value: _5}};
|
|
|
|
|
var vn6 = h('option', p6, c6);
|
|
|
|
|
c2.push(vn6);
|
|
|
|
|
c6.push({text: \`Red\`});
|
|
|
|
|
var _7 = 'blue';
|
|
|
|
|
let c8 = [], p8 = {key:8,attrs:{value: _7}};
|
|
|
|
|
var vn8 = h('option', p8, c8);
|
|
|
|
|
c2.push(vn8);
|
|
|
|
|
c8.push({text: \`Blue\`});
|
|
|
|
|
let c9 = [], p9 = {key:9};
|
|
|
|
|
var vn9 = h('span', p9, c9);
|
|
|
|
|
c1.push(vn9);
|
|
|
|
|
c9.push({text: \`Choice: \`});
|
|
|
|
|
var _10 = context['state'].color;
|
|
|
|
|
if (_10 || _10 === 0) {
|
|
|
|
|
c9.push({text: _10});
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-model directive on an input type=radio 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
var _2 = 'radio';
|
|
|
|
|
var _3 = 'one';
|
|
|
|
|
var _4 = 'One';
|
|
|
|
|
let c5 = [], p5 = {key:5,attrs:{type: _2,id: _3,value: _4},on:{}};
|
|
|
|
|
var vn5 = h('input', p5, c5);
|
|
|
|
|
c1.push(vn5);
|
|
|
|
|
p5.props = {checked:context.state['choice'] === 'One'};
|
|
|
|
|
extra.handlers['click' + 5] = extra.handlers['click' + 5] || ((ev) => {context.state['choice'] = ev.target.value});
|
|
|
|
|
p5.on['click'] = extra.handlers['click' + 5];
|
|
|
|
|
var _6 = 'radio';
|
|
|
|
|
var _7 = 'two';
|
|
|
|
|
var _8 = 'Two';
|
|
|
|
|
let c9 = [], p9 = {key:9,attrs:{type: _6,id: _7,value: _8},on:{}};
|
|
|
|
|
var vn9 = h('input', p9, c9);
|
|
|
|
|
c1.push(vn9);
|
|
|
|
|
p9.props = {checked:context.state['choice'] === 'Two'};
|
|
|
|
|
extra.handlers['click' + 9] = extra.handlers['click' + 9] || ((ev) => {context.state['choice'] = ev.target.value});
|
|
|
|
|
p9.on['click'] = extra.handlers['click' + 9];
|
|
|
|
|
let c10 = [], p10 = {key:10};
|
|
|
|
|
var vn10 = h('span', p10, c10);
|
|
|
|
|
c1.push(vn10);
|
|
|
|
|
c10.push({text: \`Choice: \`});
|
|
|
|
|
var _11 = context['state'].choice;
|
|
|
|
|
if (_11 || _11 === 0) {
|
|
|
|
|
c10.push({text: _11});
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-model directive on an input, type=checkbox 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
var _2 = 'checkbox';
|
|
|
|
|
let c3 = [], p3 = {key:3,attrs:{type: _2},on:{}};
|
|
|
|
|
var vn3 = h('input', p3, c3);
|
|
|
|
|
c1.push(vn3);
|
|
|
|
|
p3.props = {checked: context.state['flag']};
|
|
|
|
|
extra.handlers['input' + 3] = extra.handlers['input' + 3] || ((ev) => {context.state['flag'] = ev.target.checked});
|
|
|
|
|
p3.on['input'] = extra.handlers['input' + 3];
|
|
|
|
|
let c4 = [], p4 = {key:4};
|
|
|
|
|
var vn4 = h('span', p4, c4);
|
|
|
|
|
c1.push(vn4);
|
|
|
|
|
if (context['state'].flag) {
|
|
|
|
|
c4.push({text: \`yes\`});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
c4.push({text: \`no\`});
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
2019-06-11 15:02:10 +02:00
|
|
|
exports[`t-slot directive can define and call slots 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
2019-06-20 09:42:33 +02:00
|
|
|
//COMPONENT
|
2019-06-11 15:02:10 +02:00
|
|
|
let def3;
|
|
|
|
|
let w4 = 4 in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[4]] : false;
|
2019-06-14 10:17:13 +02:00
|
|
|
let _2_index = c1.length;
|
|
|
|
|
c1.push(null);
|
2019-06-11 15:02:10 +02:00
|
|
|
let props4 = {};
|
|
|
|
|
if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props4, w4.__owl__.renderProps)) {
|
|
|
|
|
def3 = w4.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w4.destroy();
|
|
|
|
|
w4 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w4) {
|
2019-06-20 09:42:33 +02:00
|
|
|
let componentKey4 = \`Dialog\`;
|
|
|
|
|
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
|
|
|
|
|
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
|
2019-06-11 15:02:10 +02:00
|
|
|
w4 = new W4(owner, props4);
|
|
|
|
|
context.__owl__.cmap[4] = w4.__owl__.id;
|
2019-06-13 11:41:46 +02:00
|
|
|
w4.__owl__.slotId = 1;
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = w4.__prepare();
|
|
|
|
|
def3 = def3.then(vnode=>{let pvnode=h(vnode.sel, {key: 4, hook: {insert(vn) {let nvn=w4.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w4.destroy();}}});c1[_2_index]=pvnode;w4.__owl__.pvnode = pvnode;});
|
2019-06-11 15:02:10 +02:00
|
|
|
} else {
|
2019-06-24 13:02:12 +02:00
|
|
|
def3 = def3 || w4.__updateProps(props4, extra.forceUpdate, extra.patchQueue);
|
2019-06-11 15:02:10 +02:00
|
|
|
def3 = def3.then(()=>{if (w4.__owl__.isDestroyed) {return};let pvnode=w4.__owl__.pvnode;c1[_2_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def3);
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-slot directive can define and call slots 2`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2};
|
|
|
|
|
var vn2 = h('div', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
2019-06-13 11:41:46 +02:00
|
|
|
const slot3 = this.slots[context.__owl__.slotId + '_' + 'header'];
|
2019-06-24 12:57:15 +02:00
|
|
|
if (slot3) {
|
2019-07-05 09:45:55 +02:00
|
|
|
slot3(context.__owl__.parent, Object.assign({}, extra, {parentNode: c2, vars: extra.vars}));
|
2019-06-24 12:57:15 +02:00
|
|
|
}
|
2019-06-11 15:02:10 +02:00
|
|
|
let c4 = [], p4 = {key:4};
|
|
|
|
|
var vn4 = h('div', p4, c4);
|
|
|
|
|
c1.push(vn4);
|
2019-06-13 11:41:46 +02:00
|
|
|
const slot5 = this.slots[context.__owl__.slotId + '_' + 'footer'];
|
2019-06-24 12:57:15 +02:00
|
|
|
if (slot5) {
|
2019-07-05 09:45:55 +02:00
|
|
|
slot5(context.__owl__.parent, Object.assign({}, extra, {parentNode: c4, vars: extra.vars}));
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
var _1 = context['props'].to;
|
|
|
|
|
let c2 = [], p2 = {key:2,attrs:{href: _1}};
|
|
|
|
|
var vn2 = h('a', p2, c2);
|
|
|
|
|
const slot3 = this.slots[context.__owl__.slotId + '_' + 'default'];
|
|
|
|
|
if (slot3) {
|
|
|
|
|
slot3(context.__owl__.parent, Object.assign({}, extra, {parentNode: c2, vars: extra.vars}));
|
|
|
|
|
}
|
|
|
|
|
return vn2;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 2 2`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
context = Object.create(context);
|
|
|
|
|
const scope = Object.create(null);
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2};
|
|
|
|
|
var vn2 = h('u', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
var _3 = context['state'].users;
|
|
|
|
|
if (!_3) { throw new Error('QWeb error: Invalid loop expression')}
|
|
|
|
|
var _4 = _5 = _3;
|
|
|
|
|
if (!(_3 instanceof Array)) {
|
|
|
|
|
_4 = Object.keys(_3);
|
|
|
|
|
_5 = Object.values(_3);
|
|
|
|
|
}
|
|
|
|
|
var _length4 = _4.length;
|
|
|
|
|
for (let i = 0; i < _length4; i++) {
|
|
|
|
|
context.user_first = i === 0;
|
|
|
|
|
scope.user_first = context.user_first;
|
|
|
|
|
context.user_last = i === _length4 - 1;
|
|
|
|
|
scope.user_last = context.user_last;
|
|
|
|
|
context.user_index = i;
|
|
|
|
|
scope.user_index = context.user_index;
|
|
|
|
|
context.user = _4[i];
|
|
|
|
|
scope.user = context.user;
|
|
|
|
|
context.user_value = _5[i];
|
|
|
|
|
scope.user_value = context.user_value;
|
|
|
|
|
let c6 = [], p6 = {key:context['user'].id};
|
|
|
|
|
var vn6 = h('li', p6, c6);
|
|
|
|
|
c2.push(vn6);
|
|
|
|
|
//COMPONENT
|
|
|
|
|
let def8;
|
|
|
|
|
let w9 = String(-9 - i) in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[String(-9 - i)]] : false;
|
|
|
|
|
let _7_index = c6.length;
|
|
|
|
|
c6.push(null);
|
|
|
|
|
let props9 = {to:'/user/'+context['user'].id};
|
|
|
|
|
if (w9 && w9.__owl__.renderPromise && !w9.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props9, w9.__owl__.renderProps)) {
|
|
|
|
|
def8 = w9.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w9.destroy();
|
|
|
|
|
w9 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w9) {
|
|
|
|
|
let componentKey9 = \`Link\`;
|
|
|
|
|
let W9 = context.components && context.components[componentKey9] || QWeb.components[componentKey9];
|
|
|
|
|
if (!W9) {throw new Error('Cannot find the definition of component \\"' + componentKey9 + '\\"')}
|
|
|
|
|
w9 = new W9(owner, props9);
|
|
|
|
|
context.__owl__.cmap[String(-9 - i)] = w9.__owl__.id;
|
|
|
|
|
w9.__owl__.slotId = 1;
|
|
|
|
|
def8 = w9.__prepare(Object.assign({}, scope), {});
|
|
|
|
|
def8 = def8.then(vnode=>{let pvnode=h(vnode.sel, {key: String(-9 - i), hook: {insert(vn) {let nvn=w9.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w9.destroy();}}});c6[_7_index]=pvnode;w9.__owl__.pvnode = pvnode;});
|
|
|
|
|
} else {
|
|
|
|
|
def8 = def8 || w9.__updateProps(props9, extra.forceUpdate, extra.patchQueue, Object.assign({}, scope), {});
|
|
|
|
|
def8 = def8.then(()=>{if (w9.__owl__.isDestroyed) {return};let pvnode=w9.__owl__.pvnode;c6[_7_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def8);
|
|
|
|
|
}
|
|
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 1`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
var _1 = context['props'].to;
|
|
|
|
|
let c2 = [], p2 = {key:2,attrs:{href: _1}};
|
|
|
|
|
var vn2 = h('a', p2, c2);
|
|
|
|
|
const slot3 = this.slots[context.__owl__.slotId + '_' + 'default'];
|
|
|
|
|
if (slot3) {
|
|
|
|
|
slot3(context.__owl__.parent, Object.assign({}, extra, {parentNode: c2, vars: extra.vars}));
|
|
|
|
|
}
|
|
|
|
|
return vn2;
|
|
|
|
|
}"
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
exports[`t-slot directive slots are rendered with proper context, part 3 2`] = `
|
|
|
|
|
"function anonymous(context,extra
|
|
|
|
|
) {
|
|
|
|
|
let utils = this.utils;
|
|
|
|
|
let QWeb = this.constructor;
|
|
|
|
|
let owner = context;
|
|
|
|
|
context = Object.create(context);
|
|
|
|
|
const scope = Object.create(null);
|
|
|
|
|
var h = this.utils.h;
|
|
|
|
|
let c1 = [], p1 = {key:1};
|
|
|
|
|
var vn1 = h('div', p1, c1);
|
|
|
|
|
let c2 = [], p2 = {key:2};
|
|
|
|
|
var vn2 = h('u', p2, c2);
|
|
|
|
|
c1.push(vn2);
|
|
|
|
|
var _3 = context['state'].users;
|
|
|
|
|
if (!_3) { throw new Error('QWeb error: Invalid loop expression')}
|
|
|
|
|
var _4 = _5 = _3;
|
|
|
|
|
if (!(_3 instanceof Array)) {
|
|
|
|
|
_4 = Object.keys(_3);
|
|
|
|
|
_5 = Object.values(_3);
|
|
|
|
|
}
|
|
|
|
|
var _length4 = _4.length;
|
|
|
|
|
for (let i = 0; i < _length4; i++) {
|
|
|
|
|
context.user_first = i === 0;
|
|
|
|
|
scope.user_first = context.user_first;
|
|
|
|
|
context.user_last = i === _length4 - 1;
|
|
|
|
|
scope.user_last = context.user_last;
|
|
|
|
|
context.user_index = i;
|
|
|
|
|
scope.user_index = context.user_index;
|
|
|
|
|
context.user = _4[i];
|
|
|
|
|
scope.user = context.user;
|
|
|
|
|
context.user_value = _5[i];
|
|
|
|
|
scope.user_value = context.user_value;
|
|
|
|
|
let c6 = [], p6 = {key:context['user'].id};
|
|
|
|
|
var vn6 = h('li', p6, c6);
|
|
|
|
|
c2.push(vn6);
|
|
|
|
|
var _7 = 'User '+context['user'].name;
|
|
|
|
|
//COMPONENT
|
|
|
|
|
let def9;
|
|
|
|
|
let w10 = String(-10 - i) in context.__owl__.cmap ? context.__owl__.children[context.__owl__.cmap[String(-10 - i)]] : false;
|
|
|
|
|
let _8_index = c6.length;
|
|
|
|
|
c6.push(null);
|
|
|
|
|
let props10 = {to:'/user/'+context['user'].id};
|
|
|
|
|
if (w10 && w10.__owl__.renderPromise && !w10.__owl__.vnode) {
|
|
|
|
|
if (utils.shallowEqual(props10, w10.__owl__.renderProps)) {
|
|
|
|
|
def9 = w10.__owl__.renderPromise;
|
|
|
|
|
} else {
|
|
|
|
|
w10.destroy();
|
|
|
|
|
w10 = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!w10) {
|
|
|
|
|
let componentKey10 = \`Link\`;
|
|
|
|
|
let W10 = context.components && context.components[componentKey10] || QWeb.components[componentKey10];
|
|
|
|
|
if (!W10) {throw new Error('Cannot find the definition of component \\"' + componentKey10 + '\\"')}
|
|
|
|
|
w10 = new W10(owner, props10);
|
|
|
|
|
context.__owl__.cmap[String(-10 - i)] = w10.__owl__.id;
|
|
|
|
|
w10.__owl__.slotId = 1;
|
|
|
|
|
def9 = w10.__prepare(Object.assign({}, scope), {_7});
|
|
|
|
|
def9 = def9.then(vnode=>{let pvnode=h(vnode.sel, {key: String(-10 - i), hook: {insert(vn) {let nvn=w10.__mount(vnode, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w10.destroy();}}});c6[_8_index]=pvnode;w10.__owl__.pvnode = pvnode;});
|
|
|
|
|
} else {
|
|
|
|
|
def9 = def9 || w10.__updateProps(props10, extra.forceUpdate, extra.patchQueue, Object.assign({}, scope), {_7});
|
|
|
|
|
def9 = def9.then(()=>{if (w10.__owl__.isDestroyed) {return};let pvnode=w10.__owl__.pvnode;c6[_8_index]=pvnode;});
|
|
|
|
|
}
|
|
|
|
|
extra.promises.push(def9);
|
2019-06-24 12:57:15 +02:00
|
|
|
}
|
2019-06-11 15:02:10 +02:00
|
|
|
return vn1;
|
|
|
|
|
}"
|
|
|
|
|
`;
|