mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
27629cedfa
the low level method htmlelement.classList.add does not accept multiple
classes in one string, which is why, in owl, the expression
`<div t-att-class="{'a b c': value}" />`
did not work as one might expect. It is however very convenient in real
life templates, so this commit improve owl by adding support for this
feature.
closes #813
30 lines
817 B
Plaintext
30 lines
817 B
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`qweb t-att t-att-class with multiple classes 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.toClassObj({'a b c':scope['value']});
|
|
let c2 = [], p2 = {key:2,class:_1};
|
|
let vn2 = h('div', p2, c2);
|
|
return vn2;
|
|
}"
|
|
`;
|
|
|
|
exports[`qweb t-att t-att-class with multiple classes 2`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let utils = this.constructor.utils;
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let _3 = utils.toClassObj({['a b c']:scope['value']});
|
|
let c4 = [], p4 = {key:4,class:_3};
|
|
let vn4 = h('div', p4, c4);
|
|
return vn4;
|
|
}"
|
|
`;
|