[FIX] qweb: properly handle empty class attribute

The classList.add method actually crashes when given an empty string (or
a string with just white spaces).

closes #530
This commit is contained in:
Géry Debongnie
2019-12-03 14:02:58 +01:00
committed by aab-odoo
parent 286090efca
commit f12d3373c9
5 changed files with 91 additions and 8 deletions
@@ -44,6 +44,30 @@ exports[`attributes dynamic attributes 1`] = `
}"
`;
exports[`attributes dynamic class attribute 1`] = `
"function anonymous(context,extra
) {
let utils = this.constructor.utils;
var h = this.h;
let _1 = utils.toObj(context['c']);
let c2 = [], p2 = {key:2,class:_1};
var vn2 = h('div', p2, c2);
return vn2;
}"
`;
exports[`attributes dynamic empty class attribute 1`] = `
"function anonymous(context,extra
) {
let utils = this.constructor.utils;
var h = this.h;
let _1 = utils.toObj(context['c']);
let c2 = [], p2 = {key:2,class:_1};
var vn2 = h('div', p2, c2);
return vn2;
}"
`;
exports[`attributes dynamic formatted attributes with a dash 1`] = `
"function anonymous(context,extra
) {
@@ -787,6 +811,29 @@ exports[`special cases for some boolean html attributes/properties various boole
}"
`;
exports[`static templates div with a class attribute 1`] = `
"function anonymous(context,extra
) {
var h = this.h;
let _2 = {'abc':true};
let c3 = [], p3 = {key:3,class:_2};
var 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
) {
var h = this.h;
let c2 = [], p2 = {key:2};
var 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
) {