mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
d0c76c5854
Input with type="checkbox" have a special property (indeterminate) to visually display the fact that the input value is non determinate (in my chrome browser, the checkbox is then drawn with a simple - inside). It does not actually modify the value of the input, only the way it is displayed. So, with this commit, owl will properly set the property, as expected. closes #713
3884 lines
109 KiB
Plaintext
3884 lines
109 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`attributes class and t-att-class should combine together 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = utils.toObj(scope['value']);
|
|
Object.assign(_1, {'hello':true})
|
|
let c3 = [], p3 = {key:3,class:_1};
|
|
let vn3 = h('div', p3, c3);
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes class and t-attf-class with ternary operation 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = 'hello ' + (scope['value']?'world':'');
|
|
let c2 = [], p2 = {key:2,attrs:{class: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes dynamic attribute falsy variable 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = scope['value'];
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes dynamic attribute with a dash 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = scope['id'];
|
|
let c2 = [], p2 = {key:2,attrs:{\\"data-action-id\\": _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes dynamic attributes 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = 'bar';
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes dynamic class attribute 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = utils.toObj(scope['c']);
|
|
let c2 = [], p2 = {key:2,class:_1};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes dynamic empty class attribute 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = utils.toObj(scope['c']);
|
|
let c2 = [], p2 = {key:2,class:_1};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes dynamic formatted attributes with a dash 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = \`Some text \${scope['id']}\`;
|
|
let c2 = [], p2 = {key:2,attrs:{\\"aria-label\\": _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes fixed variable 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = scope['value'];
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes format expression 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = (scope['value']+37);
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes format expression, other format 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = (scope['value']+37);
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes format literal 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _1 = \`bar\`;
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes format multiple 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = \`a \${scope['value1']} is \${scope['value2']} of \${scope['value3']} ]\`;
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes format value 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = \`b\${scope['value']}r\`;
|
|
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes from object variables set previously 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.o = {a:'b'};
|
|
let _2 = utils.toObj(scope.o.a);
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes from variables set previously 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.abc = 'def';
|
|
let _2 = utils.toObj(scope.abc);
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes object 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = scope['value'];
|
|
let c2 = [], p2 = {key:2,attrs:{}};
|
|
if (_1 instanceof Array) {
|
|
p2.attrs[_1[0]] = _1[1];
|
|
} else {
|
|
for (let key in _1) {
|
|
p2.attrs[key] = _1[key];
|
|
}
|
|
}
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes static attributes 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _1 = 'a';
|
|
let _2 = 'b';
|
|
let _3 = 'c';
|
|
let c4 = [], p4 = {key:4,attrs:{foo: _1,bar: _2,baz: _3}};
|
|
let vn4 = h('div', p4, c4);
|
|
return vn4;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes static attributes on void elements 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _1 = '/test.jpg';
|
|
let _2 = 'Test';
|
|
let c3 = [], p3 = {key:3,attrs:{src: _1,alt: _2}};
|
|
let vn3 = h('img', p3, c3);
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes static attributes with dashes 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _1 = 'Close';
|
|
let c2 = [], p2 = {key:2,attrs:{\\"aria-label\\": _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes t-att-class and class should combine together 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _2 = {'hello':true};
|
|
Object.assign(_2, utils.toObj(scope['value']))
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
let vn3 = h('div', p3, c3);
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes t-att-class with object 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _2 = {'static':true};
|
|
Object.assign(_2, utils.toObj({a:scope['b'],c:scope['d'],e:scope['f']}))
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
let vn3 = h('div', p3, c3);
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes t-attf-class should combine with class 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _1 = 'hello ' + \`world\`;
|
|
let c2 = [], p2 = {key:2,attrs:{class: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes tuple literal 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = ['foo','bar'];
|
|
let c2 = [], p2 = {key:2,attrs:{}};
|
|
if (_1 instanceof Array) {
|
|
p2.attrs[_1[0]] = _1[1];
|
|
} else {
|
|
for (let key in _1) {
|
|
p2.attrs[key] = _1[key];
|
|
}
|
|
}
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes tuple variable 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = scope['value'];
|
|
let c2 = [], p2 = {key:2,attrs:{}};
|
|
if (_1 instanceof Array) {
|
|
p2.attrs[_1[0]] = _1[1];
|
|
} else {
|
|
for (let key in _1) {
|
|
p2.attrs[key] = _1[key];
|
|
}
|
|
}
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`attributes various escapes 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = '<foo';
|
|
let _2 = scope['bar'];
|
|
let _3 = \`<\${scope['baz']}>\`;
|
|
let _4 = scope['qux'];
|
|
let c5 = [], p5 = {key:5,attrs:{foo: _1,bar: _2,baz: _3}};
|
|
if (_4 instanceof Array) {
|
|
p5.attrs[_4[0]] = _4[1];
|
|
} else {
|
|
for (let key in _4) {
|
|
p5.attrs[key] = _4[key];
|
|
}
|
|
}
|
|
let vn5 = h('div', p5, c5);
|
|
return vn5;
|
|
}"
|
|
`;
|
|
|
|
exports[`debugging t-debug 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
debugger;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (true) {
|
|
debugger;
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`hey\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`debugging t-log 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.foo = 42;
|
|
console.log(scope.foo+3)
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach does not pollute the rendering context 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = [1];
|
|
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 _6 = scope['item'];
|
|
if (_6 != null) {
|
|
c1.push({text: _6});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach iterate on items (on a element node) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = [1,2];
|
|
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 = scope['item'];
|
|
let c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
let _7 = scope['item'];
|
|
if (_7 != null) {
|
|
c6.push({text: _7});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach iterate on items 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = [3,2,1];
|
|
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;
|
|
c1.push({text: \` [\`});
|
|
let _6 = scope['item_index'];
|
|
if (_6 != null) {
|
|
c1.push({text: _6});
|
|
}
|
|
c1.push({text: \`: \`});
|
|
let _7 = scope['item'];
|
|
if (_7 != null) {
|
|
c1.push({text: _7});
|
|
}
|
|
c1.push({text: \` \`});
|
|
let _8 = scope['item_value'];
|
|
if (_8 != null) {
|
|
c1.push({text: _8});
|
|
}
|
|
c1.push({text: \`] \`});
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach iterate, dict param 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = scope['value'];
|
|
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;
|
|
c1.push({text: \` [\`});
|
|
let _6 = scope['item_index'];
|
|
if (_6 != null) {
|
|
c1.push({text: _6});
|
|
}
|
|
c1.push({text: \`: \`});
|
|
let _7 = scope['item'];
|
|
if (_7 != null) {
|
|
c1.push({text: _7});
|
|
}
|
|
c1.push({text: \` \`});
|
|
let _8 = scope['item_value'];
|
|
if (_8 != null) {
|
|
c1.push({text: _8});
|
|
}
|
|
c1.push({text: \`] \`});
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach iterate, position 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = Array(5);
|
|
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.elem_first = i1 === 0
|
|
scope.elem_last = i1 === _length3 - 1
|
|
scope.elem_index = i1
|
|
scope.elem = _3[i1]
|
|
scope.elem_value = _4[i1]
|
|
let key1 = i1;
|
|
c1.push({text: \` -\`});
|
|
if (scope['elem_first']) {
|
|
c1.push({text: \` first\`});
|
|
}
|
|
if (scope['elem_last']) {
|
|
c1.push({text: \` last\`});
|
|
}
|
|
c1.push({text: \` (\`});
|
|
let _6 = scope['elem_index'];
|
|
if (_6 != null) {
|
|
c1.push({text: _6});
|
|
}
|
|
c1.push({text: \`) \`});
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach t-call with body in t-foreach in t-foreach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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['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.a_first = i1 === 0
|
|
scope.a_last = i1 === _length3 - 1
|
|
scope.a_index = i1
|
|
scope.a = _3[i1]
|
|
scope.a_value = _4[i1]
|
|
let key1 = i1;
|
|
let _6 = scope['letters'];
|
|
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.b_first = i2 === 0
|
|
scope.b_last = i2 === _length7 - 1
|
|
scope.b_index = i2
|
|
scope.b = _7[i2]
|
|
scope.b_value = _8[i2]
|
|
let key2 = i2;
|
|
let _origScope13 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'c').c = 'x'+'_'+scope['a']+'_'+scope['b'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k14 = \`__14__\${key1}__\${key2}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: k14}));
|
|
}
|
|
scope = _origScope13;
|
|
}
|
|
scope = _origScope9;
|
|
let c15 = [], p15 = {key:\`\${key1}_15\`};
|
|
let vn15 = h('span', p15, c15);
|
|
c1.push(vn15);
|
|
if (scope.c != null) {
|
|
c15.push({text: scope.c});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
let c16 = [], p16 = {key:16};
|
|
let vn16 = h('span', p16, c16);
|
|
c1.push(vn16);
|
|
c16.push({text: \`[\`});
|
|
let _17 = scope['a'];
|
|
if (_17 != null) {
|
|
c16.push({text: _17});
|
|
}
|
|
c16.push({text: \`][\`});
|
|
let _18 = scope['b'];
|
|
if (_18 != null) {
|
|
c16.push({text: _18});
|
|
}
|
|
c16.push({text: \`][\`});
|
|
if (scope.c != null) {
|
|
c16.push({text: scope.c});
|
|
}
|
|
c16.push({text: \`]\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach t-call without body in t-foreach in t-foreach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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['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.a_first = i1 === 0
|
|
scope.a_last = i1 === _length3 - 1
|
|
scope.a_index = i1
|
|
scope.a = _3[i1]
|
|
scope.a_value = _4[i1]
|
|
let key1 = i1;
|
|
let _6 = scope['letters'];
|
|
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.b_first = i2 === 0
|
|
scope.b_last = i2 === _length7 - 1
|
|
scope.b_index = i2
|
|
scope.b = _7[i2]
|
|
scope.b_value = _8[i2]
|
|
let key2 = i2;
|
|
let _origScope12 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
let k13 = \`__13__\${key1}__\${key2}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: k13}));
|
|
scope = _origScope12;
|
|
}
|
|
scope = _origScope9;
|
|
let c14 = [], p14 = {key:\`\${key1}_14\`};
|
|
let vn14 = h('span', p14, c14);
|
|
c1.push(vn14);
|
|
let _15 = scope['c'];
|
|
if (_15 != null) {
|
|
c14.push({text: _15});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
let c16 = [], p16 = {key:16};
|
|
let vn16 = h('span', p16, c16);
|
|
c1.push(vn16);
|
|
c16.push({text: \`[\`});
|
|
let _17 = scope['a'];
|
|
if (_17 != null) {
|
|
c16.push({text: _17});
|
|
}
|
|
c16.push({text: \`][\`});
|
|
let _18 = scope['b'];
|
|
if (_18 != null) {
|
|
c16.push({text: _18});
|
|
}
|
|
c16.push({text: \`][\`});
|
|
let _19 = scope['c'];
|
|
if (_19 != null) {
|
|
c16.push({text: _19});
|
|
}
|
|
c16.push({text: \`]\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach t-foreach in t-forach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = scope['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 _6 = scope['letters'];
|
|
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.letter_first = i2 === 0
|
|
scope.letter_last = i2 === _length7 - 1
|
|
scope.letter_index = i2
|
|
scope.letter = _7[i2]
|
|
scope.letter_value = _8[i2]
|
|
let key2 = i2;
|
|
c1.push({text: \` [\`});
|
|
let _10 = scope['number'];
|
|
if (_10 != null) {
|
|
c1.push({text: _10});
|
|
}
|
|
let _11 = scope['letter'];
|
|
if (_11 != null) {
|
|
c1.push({text: _11});
|
|
}
|
|
c1.push({text: \`] \`});
|
|
}
|
|
scope = _origScope9;
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`foreach warn if no key in some case 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = [1,2];
|
|
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 c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
let _7 = scope['item'];
|
|
if (_7 != null) {
|
|
c6.push({text: _7});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`loading templates can initialize qweb with a string 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"hey\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
c1.push({text: \`jupiler\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`loading templates can load a few templates from a xml string 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('ul', p1, c1);
|
|
let _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__5__'}));
|
|
scope = _origScope4;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`misc global 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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 = [4,5,6];
|
|
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.value_first = i1 === 0
|
|
scope.value_last = i1 === _length3 - 1
|
|
scope.value_index = i1
|
|
scope.value = _3[i1]
|
|
scope.value_value = _4[i1]
|
|
let key1 = i1;
|
|
let c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('span', p6, c6);
|
|
c1.push(vn6);
|
|
let _7 = scope['value'];
|
|
if (_7 != null) {
|
|
c6.push({text: _7});
|
|
}
|
|
let _origScope10 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
let _origScope13 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'foo').foo = 'aaa';
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k14 = \`__14__\${key1}__\`;
|
|
this.constructor.subTemplates['2'].call(this, scope, Object.assign({}, extra, {parentNode: c__0, parent: utils.getComponent(context), key: k14}));
|
|
}
|
|
scope = _origScope13;
|
|
let _origScope15 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
let k16 = \`__16__\${key1}__\`;
|
|
this.constructor.subTemplates['2'].call(this, scope, Object.assign({}, extra, {parentNode: c__0, parent: utils.getComponent(context), key: k16}));
|
|
scope = _origScope15;
|
|
utils.getScope(scope, 'foo').foo = 'bbb';
|
|
let _origScope17 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
let k18 = \`__18__\${key1}__\`;
|
|
this.constructor.subTemplates['2'].call(this, scope, Object.assign({}, extra, {parentNode: c__0, parent: utils.getComponent(context), key: k18}));
|
|
scope = _origScope17;
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k19 = \`__19__\${key1}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: k19}));
|
|
}
|
|
scope = _origScope10;
|
|
}
|
|
scope = _origScope5;
|
|
let _origScope22 = 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: '__23__'}));
|
|
scope = _origScope22;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`properly support svg add proper namespace to g tags 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('g', p1, c1);
|
|
let _2 = '50';
|
|
let _3 = '50';
|
|
let _4 = '4';
|
|
let _5 = 'green';
|
|
let _6 = '1';
|
|
let _7 = 'yellow';
|
|
let c8 = [], p8 = {key:8,attrs:{cx: _2,cy: _3,r: _4,stroke: _5,\\"stroke-width\\": _6,fill: _7}};
|
|
let vn8 = h('circle', p8, c8);
|
|
c1.push(vn8);
|
|
c1.push({text: \` \`});
|
|
utils.addNameSpace(vn1);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`properly support svg add proper namespace to svg 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let _1 = '100px';
|
|
let _2 = '90px';
|
|
let c3 = [], p3 = {key:3,attrs:{width: _1,height: _2}};
|
|
let vn3 = h('svg', p3, c3);
|
|
let _4 = '50';
|
|
let _5 = '50';
|
|
let _6 = '4';
|
|
let _7 = 'green';
|
|
let _8 = '1';
|
|
let _9 = 'yellow';
|
|
let c10 = [], p10 = {key:10,attrs:{cx: _4,cy: _5,r: _6,stroke: _7,\\"stroke-width\\": _8,fill: _9}};
|
|
let vn10 = h('circle', p10, c10);
|
|
c3.push(vn10);
|
|
c3.push({text: \` \`});
|
|
utils.addNameSpace(vn3);
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`special cases for some specific html attributes/properties input type= checkbox, with t-att-checked 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _1 = 'checkbox';
|
|
let _2 = scope['flag'];
|
|
let c3 = [], p3 = {key:3,attrs:{type: _1,checked: _2},props:{checked: _2}};
|
|
let vn3 = h('input', p3, c3);
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`special cases for some specific html attributes/properties various boolean html attributes 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = 'checkbox';
|
|
let _3 = 'checked';
|
|
let c4 = [], p4 = {key:4,attrs:{type: _2,checked: _3},props:{checked: _3}};
|
|
let vn4 = h('input', p4, c4);
|
|
c1.push(vn4);
|
|
let _5 = 'checked';
|
|
let c6 = [], p6 = {key:6,attrs:{checked: _5}};
|
|
let vn6 = h('input', p6, c6);
|
|
c1.push(vn6);
|
|
let _7 = 'checked';
|
|
let c8 = [], p8 = {key:8,attrs:{checked: _7}};
|
|
let vn8 = h('div', p8, c8);
|
|
c1.push(vn8);
|
|
let _9 = 'selected';
|
|
let c10 = [], p10 = {key:10,attrs:{selected: _9}};
|
|
let vn10 = h('div', p10, c10);
|
|
c1.push(vn10);
|
|
let _11 = 'selected';
|
|
let _12 = '1';
|
|
let c13 = [], p13 = {key:13,attrs:{selected: _11,other: _12},props:{selected: _11}};
|
|
let vn13 = h('option', p13, c13);
|
|
c1.push(vn13);
|
|
let _14 = 'readonly';
|
|
let c15 = [], p15 = {key:15,attrs:{readonly: _14},props:{readonly: _14}};
|
|
let vn15 = h('input', p15, c15);
|
|
c1.push(vn15);
|
|
let _16 = 'disabled';
|
|
let c17 = [], p17 = {key:17,attrs:{disabled: _16},props:{disabled: _16}};
|
|
let vn17 = h('button', p17, c17);
|
|
c1.push(vn17);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates div with a class attribute 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _2 = {'abc':true};
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
let vn3 = h('div', p3, c3);
|
|
c3.push({text: \`word\`});
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates div with a class attribute with a quote 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _2 = {'a\\\\'bc':true};
|
|
let c3 = [], p3 = {key:3,class:_2};
|
|
let vn3 = h('div', p3, c3);
|
|
c3.push({text: \`word\`});
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates div with a empty class attribute 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('div', p2, c2);
|
|
c2.push({text: \`word\`});
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates div with a span child node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`word\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates div with a text node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
c1.push({text: \`word\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates div with an arbitrary attribute with a quote 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let _1 = 'a\\\\'bc';
|
|
let c2 = [], p2 = {key:2,attrs:{abc: _1}};
|
|
let vn2 = h('div', p2, c2);
|
|
c2.push({text: \`word\`});
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates empty div 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates properly handle comments 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
c1.push({text: \`hello \`});
|
|
c1.push(h('!', \` comment\`));
|
|
c1.push({text: \`owl\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates properly handle comments between t-if/t-else 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (true) {
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`true\`});
|
|
}
|
|
else {
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
c3.push({text: \`owl\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates simple dynamic value 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let _1 = scope['text'];
|
|
if (_1 != null) {
|
|
let vn2 = {text: _1};
|
|
result = vn2
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates simple string 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let result;
|
|
let h = this.h;
|
|
let vn1 = {text: \`hello vdom\`};
|
|
result = vn1;
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`static templates simple string, with some dynamic value 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let vn1 = {text: \`hello \`};
|
|
result = vn1;
|
|
let _2 = scope['text'];
|
|
if (_2 != null) {
|
|
vn1.text += _2;
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling basic caller 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling basic caller, no parent node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
result = []
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: result, parent: utils.getComponent(context), key: '__4__'}));
|
|
result = result[0]
|
|
scope = _origScope3;
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling call with several sub nodes on same line 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
let c4 = [], p4 = {key:4};
|
|
let vn4 = h('span', p4, c4);
|
|
c__0.push(vn4);
|
|
c4.push({text: \`hey\`});
|
|
c__0.push({text: \` \`});
|
|
let c5 = [], p5 = {key:5};
|
|
let vn5 = h('span', p5, c5);
|
|
c__0.push(vn5);
|
|
c5.push({text: \`yay\`});
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__6__'}));
|
|
}
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling call with several sub nodes on same line 2`] = `"1"`;
|
|
|
|
exports[`t-call (template calling cascading t-call t-raw='0' 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope12 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
let c13 = [], p13 = {key:13};
|
|
let vn13 = h('span', p13, c13);
|
|
c__0.push(vn13);
|
|
c13.push({text: \`hey\`});
|
|
c__0.push({text: \` \`});
|
|
let c14 = [], p14 = {key:14};
|
|
let vn14 = h('span', p14, c14);
|
|
c__0.push(vn14);
|
|
c14.push({text: \`yay\`});
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__15__'}));
|
|
}
|
|
scope = _origScope12;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling inherit context 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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.foo = 1;
|
|
let _origScope2 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__3__'}));
|
|
scope = _origScope2;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 1 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"recursive\\"
|
|
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 c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`hey\`});
|
|
if (false) {
|
|
let _origScope7 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__8__'}));
|
|
scope = _origScope7;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 1 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"recursive\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let key0 = extra.key || \\"\\";
|
|
let c3 = [], p3 = {key:\`\${key0}_3\`};
|
|
let vn3 = h('div', p3, c3);
|
|
c1.push(vn3);
|
|
let c4 = [], p4 = {key:\`\${key0}_4\`};
|
|
let vn4 = h('span', p4, c4);
|
|
c3.push(vn4);
|
|
c4.push({text: \`hey\`});
|
|
if (false) {
|
|
let _origScope5 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
let k6 = \`__6__\${key0}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c3, parent: utils.getComponent(context), key: k6}));
|
|
scope = _origScope5;
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Parent\\"
|
|
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 _origScope11 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'node').node = scope['root'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__12__'}));
|
|
}
|
|
scope = _origScope11;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 2 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"nodeTemplate\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let key0 = extra.key || \\"\\";
|
|
let c2 = [], p2 = {key:\`\${key0}_2\`};
|
|
let vn2 = h('div', p2, c2);
|
|
c1.push(vn2);
|
|
let c3 = [], p3 = {key:\`\${key0}_3\`};
|
|
let vn3 = h('p', p3, c3);
|
|
c2.push(vn3);
|
|
let _4 = scope['node'].val;
|
|
if (_4 != null) {
|
|
c3.push({text: _4});
|
|
}
|
|
let _5 = scope['node'].children||[];
|
|
if (!_5) { throw new Error('QWeb error: Invalid loop expression')}
|
|
let _6 = _7 = _5;
|
|
if (!(_5 instanceof Array)) {
|
|
_6 = Object.keys(_5);
|
|
_7 = Object.values(_5);
|
|
}
|
|
let _length6 = _6.length;
|
|
let _origScope8 = scope;
|
|
scope = Object.create(scope);
|
|
for (let i1 = 0; i1 < _length6; i1++) {
|
|
scope.subtree_first = i1 === 0
|
|
scope.subtree_last = i1 === _length6 - 1
|
|
scope.subtree_index = i1
|
|
scope.subtree = _6[i1]
|
|
scope.subtree_value = _7[i1]
|
|
let key1 = i1;
|
|
let _origScope9 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'node').node = scope['subtree'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k10 = \`__10__\${key0}__\${key1}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c2, parent: utils.getComponent(context), key: k10}));
|
|
}
|
|
scope = _origScope9;
|
|
}
|
|
scope = _origScope8;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 3 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Parent\\"
|
|
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 _origScope11 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'node').node = scope['root'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__12__'}));
|
|
}
|
|
scope = _origScope11;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 3 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"nodeTemplate\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let key0 = extra.key || \\"\\";
|
|
let c2 = [], p2 = {key:\`\${key0}_2\`};
|
|
let vn2 = h('div', p2, c2);
|
|
c1.push(vn2);
|
|
let c3 = [], p3 = {key:\`\${key0}_3\`};
|
|
let vn3 = h('p', p3, c3);
|
|
c2.push(vn3);
|
|
let _4 = scope['node'].val;
|
|
if (_4 != null) {
|
|
c3.push({text: _4});
|
|
}
|
|
let _5 = scope['node'].children||[];
|
|
if (!_5) { throw new Error('QWeb error: Invalid loop expression')}
|
|
let _6 = _7 = _5;
|
|
if (!(_5 instanceof Array)) {
|
|
_6 = Object.keys(_5);
|
|
_7 = Object.values(_5);
|
|
}
|
|
let _length6 = _6.length;
|
|
let _origScope8 = scope;
|
|
scope = Object.create(scope);
|
|
for (let i1 = 0; i1 < _length6; i1++) {
|
|
scope.subtree_first = i1 === 0
|
|
scope.subtree_last = i1 === _length6 - 1
|
|
scope.subtree_index = i1
|
|
scope.subtree = _6[i1]
|
|
scope.subtree_value = _7[i1]
|
|
let key1 = i1;
|
|
let _origScope9 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'node').node = scope['subtree'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k10 = \`__10__\${key0}__\${key1}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c2, parent: utils.getComponent(context), key: k10}));
|
|
}
|
|
scope = _origScope9;
|
|
}
|
|
scope = _origScope8;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 4: with t-set recursive index 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"Parent\\"
|
|
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 _origScope11 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'recursive_idx').recursive_idx = 1;
|
|
utils.getScope(scope, 'node').node = scope['root'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__12__'}));
|
|
}
|
|
scope = _origScope11;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling recursive template, part 4: with t-set recursive index 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"nodeTemplate\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = extra.parentNode;
|
|
let key0 = extra.key || \\"\\";
|
|
let c2 = [], p2 = {key:\`\${key0}_2\`};
|
|
let vn2 = h('div', p2, c2);
|
|
c1.push(vn2);
|
|
scope.recursive_idx = scope.recursive_idx+1;
|
|
let c3 = [], p3 = {key:\`\${key0}_3\`};
|
|
let vn3 = h('p', p3, c3);
|
|
c2.push(vn3);
|
|
let _4 = scope['node'].val;
|
|
if (_4 != null) {
|
|
c3.push({text: _4});
|
|
}
|
|
c3.push({text: \` \`});
|
|
if (scope.recursive_idx != null) {
|
|
c3.push({text: scope.recursive_idx});
|
|
}
|
|
let _5 = scope['node'].children||[];
|
|
if (!_5) { throw new Error('QWeb error: Invalid loop expression')}
|
|
let _6 = _7 = _5;
|
|
if (!(_5 instanceof Array)) {
|
|
_6 = Object.keys(_5);
|
|
_7 = Object.values(_5);
|
|
}
|
|
let _length6 = _6.length;
|
|
let _origScope8 = scope;
|
|
scope = Object.create(scope);
|
|
for (let i1 = 0; i1 < _length6; i1++) {
|
|
scope.subtree_first = i1 === 0
|
|
scope.subtree_last = i1 === _length6 - 1
|
|
scope.subtree_index = i1
|
|
scope.subtree = _6[i1]
|
|
scope.subtree_value = _7[i1]
|
|
let key1 = i1;
|
|
let _origScope9 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'node').node = scope['subtree'];
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k10 = \`__10__\${key0}__\${key1}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c2, parent: utils.getComponent(context), key: k10}));
|
|
}
|
|
scope = _origScope9;
|
|
}
|
|
scope = _origScope8;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling scoped parameters 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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 _origScope2 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'foo').foo = 42;
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__3__'}));
|
|
}
|
|
scope = _origScope2;
|
|
if (scope.foo != null) {
|
|
c1.push({text: scope.foo});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call allowed on a non t node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call with t-if 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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);
|
|
if (scope['flag']) {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call with t-set inside and body text content 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
let c5 = new utils.VDomArray();
|
|
c5.push({text: \`yip yip\`});
|
|
scope.val = c5
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__6__'}));
|
|
}
|
|
scope = _origScope4;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call with t-set inside and outside 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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['list'];
|
|
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.v_first = i1 === 0
|
|
scope.v_last = i1 === _length3 - 1
|
|
scope.v_index = i1
|
|
scope.v = _3[i1]
|
|
scope.v_value = _4[i1]
|
|
let key1 = i1;
|
|
utils.getScope(scope, 'val').val = scope['v'].val;
|
|
let _origScope8 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'val3').val3 = scope.val*3;
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
let k9 = \`__9__\${key1}__\`;
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: k9}));
|
|
}
|
|
scope = _origScope8;
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call with t-set inside and outside. 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"wrapper\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('p', p1, c1);
|
|
scope.w = 'fromwrapper';
|
|
let _origScope11 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__12__'}));
|
|
scope = _origScope11;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call, conditional and t-set in t-call body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
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.v1 = 'elif';
|
|
if (scope.v1==='if') {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
}
|
|
else if (scope.v1==='elif') {
|
|
let _origScope7 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'v').v = 'success';
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['2'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__8__'}));
|
|
}
|
|
scope = _origScope7;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling t-call, global templates 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"abcd\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling two different QWeb instances, and shared templates 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling two different QWeb instances, and shared templates 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling with unused body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
c__0.push({text: \`WHEEE\`});
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
result = []
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: result, parent: utils.getComponent(context), key: '__4__'}));
|
|
result = result[0]
|
|
}
|
|
scope = _origScope3;
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling with unused setbody 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'qux').qux = 3;
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
result = []
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: result, parent: utils.getComponent(context), key: '__4__'}));
|
|
result = result[0]
|
|
}
|
|
scope = _origScope3;
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling with used body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
c__0.push({text: \`ok\`});
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
result = []
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: result, parent: utils.getComponent(context), key: '__4__'}));
|
|
result = result[0]
|
|
}
|
|
scope = _origScope3;
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-call (template calling with used set body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"caller\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
utils.getScope(scope, 'foo').foo = 'ok';
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__4__'}));
|
|
}
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc div with falsy values 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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['v1'];
|
|
if (_3 != null) {
|
|
c2.push({text: _3});
|
|
}
|
|
let c4 = [], p4 = {key:4};
|
|
let vn4 = h('p', p4, c4);
|
|
c1.push(vn4);
|
|
let _5 = scope['v2'];
|
|
if (_5 != null) {
|
|
c4.push({text: _5});
|
|
}
|
|
let c6 = [], p6 = {key:6};
|
|
let vn6 = h('p', p6, c6);
|
|
c1.push(vn6);
|
|
let _7 = scope['v3'];
|
|
if (_7 != null) {
|
|
c6.push({text: _7});
|
|
}
|
|
let c8 = [], p8 = {key:8};
|
|
let vn8 = h('p', p8, c8);
|
|
c1.push(vn8);
|
|
let _9 = scope['v4'];
|
|
if (_9 != null) {
|
|
c8.push({text: _9});
|
|
}
|
|
let c10 = [], p10 = {key:10};
|
|
let vn10 = h('p', p10, c10);
|
|
c1.push(vn10);
|
|
let _11 = scope['v5'];
|
|
if (_11 != null) {
|
|
c10.push({text: _11});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc escaping 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = scope['var'];
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc escaping on a node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = 'ok';
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc escaping on a node with a body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = 'ok';
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
} else {
|
|
c1.push({text: \`nope\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc escaping on a node with a body, as a default 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = scope['var'];
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
} else {
|
|
c1.push({text: \`nope\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc literal 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = 'ok';
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc t-esc inside t-call, with t-set outside 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 c2 = new utils.VDomArray();
|
|
c2.push({text: \`Hi\`});
|
|
scope.v = c2
|
|
let _origScope5 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__6__'}));
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc t-esc is escaped 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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 c2 = new utils.VDomArray();
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('p', p3, c3);
|
|
c2.push(vn3);
|
|
c3.push({text: \`escaped\`});
|
|
scope.var = c2
|
|
if (scope.var != null) {
|
|
let _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.var = scope.var instanceof utils.VDomArray ? utils.vDomToString(scope.var) : scope.var;
|
|
c1.push({text: scope.var});
|
|
scope = _origScope4;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc t-esc work with spread operator 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = [...scope['state'].list];
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc t-esc=0 is escaped 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"testCaller\\"
|
|
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 _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
{
|
|
{
|
|
let c__0 = [];
|
|
let c4 = [], p4 = {key:4};
|
|
let vn4 = h('p', p4, c4);
|
|
c__0.push(vn4);
|
|
c4.push({text: \`escaped\`});
|
|
scope[utils.zero] = c__0;
|
|
}
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__5__'}));
|
|
}
|
|
scope = _origScope3;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-esc variable 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = scope['var'];
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if boolean value condition elif 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (scope['color']=='black') {
|
|
c1.push({text: \`black pearl\`});
|
|
}
|
|
else if (scope['color']=='yellow') {
|
|
c1.push({text: \`yellow submarine\`});
|
|
}
|
|
else if (scope['color']=='red') {
|
|
c1.push({text: \`red is dead\`});
|
|
}
|
|
else {
|
|
c1.push({text: \`beer\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if boolean value condition else 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`begin\`});
|
|
if (scope['condition']) {
|
|
c1.push({text: \`ok\`});
|
|
}
|
|
else {
|
|
c1.push({text: \`ok-else\`});
|
|
}
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
c3.push({text: \`end\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if boolean value condition false else 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`begin\`});
|
|
if (scope['condition']) {
|
|
c1.push({text: \`fail\`});
|
|
}
|
|
else {
|
|
c1.push({text: \`fail-else\`});
|
|
}
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
c3.push({text: \`end\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if boolean value condition missing 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
if (scope['condition']) {
|
|
c1.push({text: \`fail\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if boolean value false condition 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (scope['condition']) {
|
|
c1.push({text: \`ok\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if boolean value true condition 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (scope['condition']) {
|
|
c1.push({text: \`ok\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if can use some boolean operators in expressions 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (scope['cond1']&&scope['cond2']) {
|
|
c1.push({text: \`and\`});
|
|
}
|
|
if (scope['cond1']&&scope['cond3']) {
|
|
c1.push({text: \`nope\`});
|
|
}
|
|
if (scope['cond1']||scope['cond3']) {
|
|
c1.push({text: \`or\`});
|
|
}
|
|
if (scope['cond3']||scope['cond4']) {
|
|
c1.push({text: \`nope\`});
|
|
}
|
|
if (scope['m']>3) {
|
|
c1.push({text: \`mgt\`});
|
|
}
|
|
if (scope['n']>3) {
|
|
c1.push({text: \`ngt\`});
|
|
}
|
|
if (scope['m']<3) {
|
|
c1.push({text: \`mlt\`});
|
|
}
|
|
if (scope['n']<3) {
|
|
c1.push({text: \`nlt\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if t-esc with t-elif 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (false) {
|
|
c1.push({text: \`abc\`});
|
|
}
|
|
else {
|
|
let _2 = 'x';
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if t-esc with t-if 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (true) {
|
|
let _2 = 'x';
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if t-set, then t-elif, part 3 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.y = false;
|
|
scope.x = scope.y;
|
|
if (scope.x) {
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`AAA\`});
|
|
}
|
|
else if (!scope.x) {
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
c3.push({text: \`BBB\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if t-set, then t-if 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.title = 'test';
|
|
if (scope.title) {
|
|
if (scope.title != null) {
|
|
c1.push({text: scope.title});
|
|
}
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-if t-set, then t-if, part 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.y = true;
|
|
scope.x = scope.y;
|
|
if (scope.x) {
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`COUCOU\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-key can use t-key directive on a node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
{
|
|
let key0 = scope['beer'].id;
|
|
let c1 = [], p1 = {key:\`\${key0}_1\`};
|
|
let vn1 = h('div', p1, c1);
|
|
result = vn1;
|
|
result = vn1;
|
|
let _2 = scope['beer'].name;
|
|
if (_2 != null) {
|
|
c1.push({text: _2});
|
|
}
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-key t-key directive in a list 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('ul', p1, c1);
|
|
let _2 = scope['beers'];
|
|
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.beer_first = i1 === 0
|
|
scope.beer_last = i1 === _length3 - 1
|
|
scope.beer_index = i1
|
|
scope.beer = _3[i1]
|
|
scope.beer_value = _4[i1]
|
|
let key1 = scope['beer'].id;
|
|
let c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('li', p6, c6);
|
|
c1.push(vn6);
|
|
let _7 = scope['beer'].name;
|
|
if (_7 != null) {
|
|
c6.push({text: _7});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-key t-key directive in a list 2`] = `"<ul><li>Chimay Rouge</li></ul>"`;
|
|
|
|
exports[`t-on can bind event handler 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
extra.handlers['click__2__'] = extra.handlers['click__2__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['add'](e);};
|
|
p1.on['click'] = extra.handlers['click__2__'];
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on can bind handlers with arguments 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
let args2 = [5];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['add'](...args2, e);};
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on can bind handlers with empty object (with non empty inner string) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
let args2 = [{}];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['doSomething'](...args2, e);};
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on can bind handlers with empty object 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
let args2 = [{}];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['doSomething'](...args2, e);};
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on can bind handlers with loop variable as argument 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('ul', p1, c1);
|
|
let _2 = ['someval'];
|
|
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.action_first = i1 === 0
|
|
scope.action_last = i1 === _length3 - 1
|
|
scope.action_index = i1
|
|
scope.action = _3[i1]
|
|
scope.action_value = _4[i1]
|
|
let key1 = scope['action_index'];
|
|
let c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('li', p6, c6);
|
|
c1.push(vn6);
|
|
let c7 = [], p7 = {key:\`\${key1}_7\`,on:{}};
|
|
let vn7 = h('a', p7, c7);
|
|
c6.push(vn7);
|
|
let args8 = [scope['action']];
|
|
p7.on['click'] = function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['activate'](...args8, e);};
|
|
c7.push({text: \`link\`});
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on can bind handlers with object arguments 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
let args2 = [{val:5}];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['add'](...args2, e);};
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on can bind two event handlers 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
extra.handlers['click__2__'] = extra.handlers['click__2__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['handleClick'](e);};
|
|
p1.on['click'] = extra.handlers['click__2__'];
|
|
extra.handlers['dblclick__3__'] = extra.handlers['dblclick__3__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['handleDblClick'](e);};
|
|
p1.on['dblclick'] = extra.handlers['dblclick__3__'];
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on handler is bound to proper owner 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
extra.handlers['click__2__'] = extra.handlers['click__2__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['add'](e);};
|
|
p1.on['click'] = extra.handlers['click__2__'];
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on combined with t-esc 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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 c2 = [], p2 = {key:2,on:{}};
|
|
let vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['onClick'](e);};
|
|
p2.on['click'] = extra.handlers['click__3__'];
|
|
let _4 = scope['text'];
|
|
if (_4 != null) {
|
|
c2.push({text: _4});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on combined with t-raw 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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 c2 = [], p2 = {key:2,on:{}};
|
|
let vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['onClick'](e);};
|
|
p2.on['click'] = extra.handlers['click__3__'];
|
|
let _4 = scope['html'];
|
|
if (_4 != null) {
|
|
c2.push(...utils.htmlToVDOM(_4));
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with .capture modifier 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('div', p1, c1);
|
|
extra.handlers['!click__2__'] = extra.handlers['!click__2__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['onCapture'](e);};
|
|
p1.on['!click'] = extra.handlers['!click__2__'];
|
|
let c3 = [], p3 = {key:3,on:{}};
|
|
let vn3 = h('button', p3, c3);
|
|
c1.push(vn3);
|
|
extra.handlers['click__4__'] = extra.handlers['click__4__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['doSomething'](e);};
|
|
p3.on['click'] = extra.handlers['click__4__'];
|
|
c3.push({text: \`Button\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with empty handler (only modifiers) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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('button', p2, c2);
|
|
c1.push(vn2);
|
|
p2.on['click'] = function (e) {if (!context.__owl__.isMounted){return}e.preventDefault();};
|
|
c2.push({text: \`Button\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with inline statement (function call) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
const state_2 = scope['state'];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}state_2.incrementCounter(2)};
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with inline statement 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
const state_2 = scope['state'];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}state_2.counter++};
|
|
c1.push({text: \`Click\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with inline statement, part 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
const state_2 = scope['state'];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}state_2.flag=!state_2.flag};
|
|
c1.push({text: \`Toggle\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with inline statement, part 3 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1,on:{}};
|
|
let vn1 = h('button', p1, c1);
|
|
const state_2 = scope['state'];
|
|
const someFunction_2 = scope['someFunction'];
|
|
p1.on['click'] = function (e) {if (!context.__owl__.isMounted){return}state_2.n=someFunction_2(3)};
|
|
c1.push({text: \`Toggle\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with prevent and self modifiers (order matters) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
let vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}e.preventDefault();if (e.target !== this.elm) {return}utils.getComponent(context)['onClick'](e);};
|
|
p2.on['click'] = extra.handlers['click__3__'];
|
|
let c4 = [], p4 = {key:4};
|
|
let vn4 = h('span', p4, c4);
|
|
c2.push(vn4);
|
|
c4.push({text: \`Button\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with prevent and/or stop modifiers 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
let vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}e.preventDefault();utils.getComponent(context)['onClickPrevented'](e);};
|
|
p2.on['click'] = extra.handlers['click__3__'];
|
|
c2.push({text: \`Button 1\`});
|
|
let c4 = [], p4 = {key:4,on:{}};
|
|
let vn4 = h('button', p4, c4);
|
|
c1.push(vn4);
|
|
extra.handlers['click__5__'] = extra.handlers['click__5__'] || function (e) {if (!context.__owl__.isMounted){return}e.stopPropagation();utils.getComponent(context)['onClickStopped'](e);};
|
|
p4.on['click'] = extra.handlers['click__5__'];
|
|
c4.push({text: \`Button 2\`});
|
|
let c6 = [], p6 = {key:6,on:{}};
|
|
let vn6 = h('button', p6, c6);
|
|
c1.push(vn6);
|
|
extra.handlers['click__7__'] = extra.handlers['click__7__'] || function (e) {if (!context.__owl__.isMounted){return}e.preventDefault();e.stopPropagation();utils.getComponent(context)['onClickPreventedAndStopped'](e);};
|
|
p6.on['click'] = extra.handlers['click__7__'];
|
|
c6.push({text: \`Button 3\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with prevent modifier in t-foreach 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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['projects'];
|
|
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.project_first = i1 === 0
|
|
scope.project_last = i1 === _length3 - 1
|
|
scope.project_index = i1
|
|
scope.project = _3[i1]
|
|
scope.project_value = _4[i1]
|
|
let key1 = i1;
|
|
{
|
|
let key1 = scope['project'];
|
|
let _6 = '#';
|
|
let c7 = [], p7 = {key:\`\${key1}_7\`,attrs:{href: _6},on:{}};
|
|
let vn7 = h('a', p7, c7);
|
|
c1.push(vn7);
|
|
let args8 = [scope['project'].id];
|
|
p7.on['click'] = function (e) {if (!context.__owl__.isMounted){return}e.preventDefault();utils.getComponent(context)['onEdit'](...args8, e);};
|
|
c7.push({text: \` Edit \`});
|
|
let _9 = scope['project'].name;
|
|
if (_9 != null) {
|
|
c7.push({text: _9});
|
|
}
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with self and prevent modifiers (order matters) 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
let vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}if (e.target !== this.elm) {return}e.preventDefault();utils.getComponent(context)['onClick'](e);};
|
|
p2.on['click'] = extra.handlers['click__3__'];
|
|
let c4 = [], p4 = {key:4};
|
|
let vn4 = h('span', p4, c4);
|
|
c2.push(vn4);
|
|
c4.push({text: \`Button\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with self modifier 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2,on:{}};
|
|
let vn2 = h('button', p2, c2);
|
|
c1.push(vn2);
|
|
extra.handlers['click__3__'] = extra.handlers['click__3__'] || function (e) {if (!context.__owl__.isMounted){return}utils.getComponent(context)['onClick'](e);};
|
|
p2.on['click'] = extra.handlers['click__3__'];
|
|
let c4 = [], p4 = {key:4};
|
|
let vn4 = h('span', p4, c4);
|
|
c2.push(vn4);
|
|
c4.push({text: \`Button\`});
|
|
let c5 = [], p5 = {key:5,on:{}};
|
|
let vn5 = h('button', p5, c5);
|
|
c1.push(vn5);
|
|
extra.handlers['click__6__'] = extra.handlers['click__6__'] || function (e) {if (!context.__owl__.isMounted){return}if (e.target !== this.elm) {return}utils.getComponent(context)['onClickSelf'](e);};
|
|
p5.on['click'] = extra.handlers['click__6__'];
|
|
let c7 = [], p7 = {key:7};
|
|
let vn7 = h('span', p7, c7);
|
|
c5.push(vn7);
|
|
c7.push({text: \`Button\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on with t-call 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__5__'}));
|
|
scope = _origScope4;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-on t-on, with arguments and t-call 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"main\\"
|
|
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 _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
this.constructor.subTemplates['1'].call(this, scope, Object.assign({}, extra, {parentNode: c1, parent: utils.getComponent(context), key: '__5__'}));
|
|
scope = _origScope4;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-raw literal 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = 'ok';
|
|
if (_2 != null) {
|
|
c1.push(...utils.htmlToVDOM(_2));
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-raw not escaping 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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['var'];
|
|
if (_2 != null) {
|
|
c1.push(...utils.htmlToVDOM(_2));
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-raw t-raw and another sibling node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`hello\`});
|
|
let _3 = scope['var'];
|
|
if (_3 != null) {
|
|
c1.push(...utils.htmlToVDOM(_3));
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-raw variable 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('span', p1, c1);
|
|
let _2 = scope['var'];
|
|
if (_2 != null) {
|
|
c1.push(...utils.htmlToVDOM(_2));
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-ref can get a dynamic ref on a node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
const ref3 = \`myspan\${scope['id']}\`;
|
|
p2.hook = {
|
|
create: (_, n) => {
|
|
context.__owl__.refs[ref3] = n.elm;
|
|
},
|
|
destroy: () => {
|
|
delete context.__owl__.refs[ref3];
|
|
},
|
|
};
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-ref can get a ref on a node 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
const ref3 = \`myspan\`;
|
|
p2.hook = {
|
|
create: (_, n) => {
|
|
context.__owl__.refs[ref3] = n.elm;
|
|
},
|
|
destroy: () => {
|
|
delete context.__owl__.refs[ref3];
|
|
},
|
|
};
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-ref refs in a loop 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
context.__owl__.refs = context.__owl__.refs || {};
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
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'];
|
|
let c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('div', p6, c6);
|
|
c1.push(vn6);
|
|
const ref7 = (scope['item']);
|
|
p6.hook = {
|
|
create: (_, n) => {
|
|
context.__owl__.refs[ref7] = n.elm;
|
|
},
|
|
destroy: () => {
|
|
delete context.__owl__.refs[ref7];
|
|
},
|
|
};
|
|
let _8 = scope['item'];
|
|
if (_8 != null) {
|
|
c6.push({text: _8});
|
|
}
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set evaluate value expression 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.value = 1+2;
|
|
if (scope.value != null) {
|
|
c1.push({text: scope.value});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set evaluate value expression, part 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.value = scope['somevariable']+2;
|
|
if (scope.value != null) {
|
|
c1.push({text: scope.value});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set set from attribute literal 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.value = 'ok';
|
|
if (scope.value != null) {
|
|
c1.push({text: scope.value});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set set from attribute lookup 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.stuff = scope['value'];
|
|
if (scope.stuff != null) {
|
|
c1.push({text: scope.stuff});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set set from body literal 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
let c1 = new utils.VDomArray();
|
|
c1.push({text: \`ok\`});
|
|
scope.value = c1
|
|
if (scope.value != null) {
|
|
let _origScope2 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.value = scope.value instanceof utils.VDomArray ? utils.vDomToString(scope.value) : scope.value;
|
|
let vn3 = {text: scope.value};
|
|
result = vn3
|
|
scope = _origScope2;
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set set from body lookup 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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 c2 = new utils.VDomArray();
|
|
let _3 = scope['value'];
|
|
if (_3 != null) {
|
|
c2.push({text: _3});
|
|
}
|
|
scope.stuff = c2
|
|
if (scope.stuff != null) {
|
|
let _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.stuff = scope.stuff instanceof utils.VDomArray ? utils.vDomToString(scope.stuff) : scope.stuff;
|
|
c1.push({text: scope.stuff});
|
|
scope = _origScope4;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set set from empty body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
if (scope.stuff != null) {
|
|
c1.push({text: scope.stuff});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set and t-if 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.v = scope['value'];
|
|
if (scope.v==='ok') {
|
|
c1.push({text: \`grimbergen\`});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set body is evaluated immediately 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.v1 = 'before';
|
|
let c2 = new utils.VDomArray();
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c2.push(vn3);
|
|
if (scope.v1 != null) {
|
|
c3.push({text: scope.v1});
|
|
}
|
|
scope.v2 = c2
|
|
scope.v1 = 'after';
|
|
if (scope.v2 != null) {
|
|
const vnodeArray = scope.v2 instanceof utils.VDomArray ? scope.v2 : utils.htmlToVDOM(scope.v2);
|
|
c1.push(...vnodeArray);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set evaluates an expression only once 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
scope.v = scope['value']+' artois';
|
|
if (scope.v != null) {
|
|
c1.push({text: scope.v});
|
|
}
|
|
if (scope.v != null) {
|
|
c1.push({text: scope.v});
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set should reuse variable if possible 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.v = 1;
|
|
let _2 = scope['list'];
|
|
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.elem_first = i1 === 0
|
|
scope.elem_last = i1 === _length3 - 1
|
|
scope.elem_index = i1
|
|
scope.elem = _3[i1]
|
|
scope.elem_value = _4[i1]
|
|
let key1 = scope['elem_index'];
|
|
let c6 = [], p6 = {key:\`\${key1}_6\`};
|
|
let vn6 = h('div', p6, c6);
|
|
c1.push(vn6);
|
|
let c7 = [], p7 = {key:\`\${key1}_7\`};
|
|
let vn7 = h('span', p7, c7);
|
|
c6.push(vn7);
|
|
c7.push({text: \`v\`});
|
|
if (scope.v != null) {
|
|
c7.push({text: scope.v});
|
|
}
|
|
utils.getScope(scope, 'v').v = scope['elem'];
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set with content and sub t-esc 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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 c2 = new utils.VDomArray();
|
|
let _3 = scope['beep'];
|
|
if (_3 != null) {
|
|
c2.push({text: _3});
|
|
}
|
|
c2.push({text: \` boop\`});
|
|
scope.setvar = c2
|
|
if (scope.setvar != null) {
|
|
let _origScope4 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.setvar = scope.setvar instanceof utils.VDomArray ? utils.vDomToString(scope.setvar) : scope.setvar;
|
|
c1.push({text: scope.setvar});
|
|
scope = _origScope4;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set with t-value (falsy) and body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.v3 = false;
|
|
scope.v1 = 'before';
|
|
scope.v2 = scope.v3;
|
|
if (!(scope.v2)) {
|
|
let c2 = new utils.VDomArray();
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c2.push(vn3);
|
|
if (scope.v1 != null) {
|
|
c3.push({text: scope.v1});
|
|
}
|
|
scope.v2 = c2
|
|
}
|
|
scope.v1 = 'after';
|
|
scope.v3 = true;
|
|
if (scope.v2 != null) {
|
|
const vnodeArray = scope.v2 instanceof utils.VDomArray ? scope.v2 : utils.htmlToVDOM(scope.v2);
|
|
c1.push(...vnodeArray);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set with t-value (truthy) and body 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.v3 = 'Truthy';
|
|
scope.v1 = 'before';
|
|
scope.v2 = scope.v3;
|
|
if (!(scope.v2)) {
|
|
let c2 = new utils.VDomArray();
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c2.push(vn3);
|
|
if (scope.v1 != null) {
|
|
c3.push({text: scope.v1});
|
|
}
|
|
scope.v2 = c2
|
|
}
|
|
scope.v1 = 'after';
|
|
scope.v3 = false;
|
|
if (scope.v2 != null) {
|
|
const vnodeArray = scope.v2 instanceof utils.VDomArray ? scope.v2 : utils.htmlToVDOM(scope.v2);
|
|
c1.push(...vnodeArray);
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set, t-if, and mix of expression/body lookup, 1 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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);
|
|
if (scope['flag']) {
|
|
let c2 = new utils.VDomArray();
|
|
c2.push({text: \`1\`});
|
|
scope.ourvar = c2
|
|
}
|
|
else {
|
|
scope.ourvar = 0;
|
|
}
|
|
if (scope.ourvar != null) {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.ourvar = scope.ourvar instanceof utils.VDomArray ? utils.vDomToString(scope.ourvar) : scope.ourvar;
|
|
c1.push({text: scope.ourvar});
|
|
scope = _origScope3;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set, t-if, and mix of expression/body lookup, 1 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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);
|
|
if (scope['flag']) {
|
|
let c2 = new utils.VDomArray();
|
|
c2.push({text: \`1\`});
|
|
scope.ourvar = c2
|
|
}
|
|
else {
|
|
scope.ourvar = 0;
|
|
}
|
|
if (scope.ourvar != null) {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.ourvar = scope.ourvar instanceof utils.VDomArray ? utils.vDomToString(scope.ourvar) : scope.ourvar;
|
|
c1.push({text: scope.ourvar});
|
|
scope = _origScope3;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set, t-if, and mix of expression/body lookup, 2 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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);
|
|
if (scope['flag']) {
|
|
scope.ourvar = 1;
|
|
}
|
|
else {
|
|
let c2 = new utils.VDomArray();
|
|
c2.push({text: \`0\`});
|
|
scope.ourvar = c2
|
|
}
|
|
if (scope.ourvar != null) {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.ourvar = scope.ourvar instanceof utils.VDomArray ? utils.vDomToString(scope.ourvar) : scope.ourvar;
|
|
c1.push({text: scope.ourvar});
|
|
scope = _origScope3;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set t-set, t-if, and mix of expression/body lookup, 2 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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);
|
|
if (scope['flag']) {
|
|
scope.ourvar = 1;
|
|
}
|
|
else {
|
|
let c2 = new utils.VDomArray();
|
|
c2.push({text: \`0\`});
|
|
scope.ourvar = c2
|
|
}
|
|
if (scope.ourvar != null) {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.ourvar = scope.ourvar instanceof utils.VDomArray ? utils.vDomToString(scope.ourvar) : scope.ourvar;
|
|
c1.push({text: scope.ourvar});
|
|
scope = _origScope3;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`t-set value priority 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
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.value = 1;
|
|
if (!(scope.value)) {
|
|
let c2 = new utils.VDomArray();
|
|
c2.push({text: \`2\`});
|
|
scope.value = c2
|
|
}
|
|
if (scope.value != null) {
|
|
let _origScope3 = scope;
|
|
scope = Object.create(scope);
|
|
scope.__access_mode__ = 'ro';
|
|
scope.value = scope.value instanceof utils.VDomArray ? utils.vDomToString(scope.value) : scope.value;
|
|
c1.push({text: scope.value});
|
|
scope = _origScope3;
|
|
}
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`translation support can translate node content 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
c1.push({text: \`mot\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`translation support does not translate node content if disabled 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`mot\`});
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('span', p3, c3);
|
|
c1.push(vn3);
|
|
c3.push({text: \`word\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`translation support some attributes are translated 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let _2 = 'mot';
|
|
let c3 = [], p3 = {key:3,attrs:{label: _2}};
|
|
let vn3 = h('p', p3, c3);
|
|
c1.push(vn3);
|
|
c3.push({text: \`mot\`});
|
|
let _4 = 'mot';
|
|
let c5 = [], p5 = {key:5,attrs:{title: _4}};
|
|
let vn5 = h('p', p5, c5);
|
|
c1.push(vn5);
|
|
c5.push({text: \`mot\`});
|
|
let _6 = 'mot';
|
|
let c7 = [], p7 = {key:7,attrs:{placeholder: _6}};
|
|
let vn7 = h('p', p7, c7);
|
|
c1.push(vn7);
|
|
c7.push({text: \`mot\`});
|
|
let _8 = 'mot';
|
|
let c9 = [], p9 = {key:9,attrs:{alt: _8}};
|
|
let vn9 = h('p', p9, c9);
|
|
c1.push(vn9);
|
|
c9.push({text: \`mot\`});
|
|
let _10 = 'word';
|
|
let c11 = [], p11 = {key:11,attrs:{something: _10}};
|
|
let vn11 = h('p', p11, c11);
|
|
c1.push(vn11);
|
|
c11.push({text: \`mot\`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`whitespace handling consecutives whitespaces are condensed into a single space 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
c1.push({text: \` abc \`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`whitespace handling nothing is done in pre tags 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('pre', p1, c1);
|
|
c1.push({text: \` \`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`whitespace handling nothing is done in pre tags 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test2\\"
|
|
let h = this.h;
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('pre', p2, c2);
|
|
c2.push({text: \`
|
|
some text
|
|
\`});
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`whitespace handling nothing is done in pre tags 3`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test3\\"
|
|
let h = this.h;
|
|
let c3 = [], p3 = {key:3};
|
|
let vn3 = h('pre', p3, c3);
|
|
c3.push({text: \`
|
|
|
|
\`});
|
|
return vn3;
|
|
}"
|
|
`;
|
|
|
|
exports[`whitespace handling white space only text nodes are condensed into a single space 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
c1.push({text: \` \`});
|
|
return vn1;
|
|
}"
|
|
`;
|
|
|
|
exports[`whitespace handling whitespace only text nodes with newlines are removed 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('div', p1, c1);
|
|
let c2 = [], p2 = {key:2};
|
|
let vn2 = h('span', p2, c2);
|
|
c1.push(vn2);
|
|
c2.push({text: \`abc\`});
|
|
return vn1;
|
|
}"
|
|
`;
|