mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
396 lines
14 KiB
Plaintext
396 lines
14 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`style and class handling can set class on multi root component 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block2 = createBlock(\`<div>a</div>\`);
|
|
let block3 = createBlock(\`<span block-attribute-0=\\"class\\">b</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = block2();
|
|
let d1 = ctx['props'].class;
|
|
let b3 = block3([d1]);
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set class on multi root component 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'fromparent'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set class on sub component, as prop 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set class on sub component, as prop 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'some-class'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set class on sub sub component 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">childchild</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set class on sub sub component 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`ChildChild\`, {class: (ctx['props'].class||'')+' fromchild'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set class on sub sub component 3`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'fromparent'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set more than one class on sub component 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set more than one class on sub component 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'a b'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling can set style and class inside component 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div style=\\"font-weight:bold;\\" class=\\"some-class\\">world</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class on sub component, which is switched to another 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">a</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class on sub component, which is switched to another 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<span block-attribute-0=\\"class\\">b</span>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class on sub component, which is switched to another 3`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2,b3;
|
|
if (ctx['props'].child==='a') {
|
|
b2 = component(\`ChildA\`, {class: ctx['props'].class}, key + \`__1\`, node, ctx);
|
|
} else {
|
|
b3 = component(\`ChildB\`, {class: ctx['props'].class}, key + \`__2\`, node, ctx);
|
|
}
|
|
return multi([b2, b3]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class on sub component, which is switched to another 4`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'someclass',child: ctx['state'].child}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class with extra whitespaces (variation) 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class with extra whitespaces (variation) 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<p><block-child-0/></p>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = component(\`Child\`, {class: 'a b c d'}, key + \`__1\`, node, ctx);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class with extra whitespaces 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling class with extra whitespaces 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'a b c d'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling component class and parent class combine together 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div class=\\"child\\" block-attribute-0=\\"class\\">child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling component class and parent class combine together 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'from parent'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling empty class attribute is not added on widget root el 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<span block-attribute-0=\\"class\\"/>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling empty class attribute is not added on widget root el 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = component(\`Child\`, {class: undefined}, key + \`__1\`, node, ctx);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling no class is set is child ignores it 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div>child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return block1();
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling no class is set is child ignores it 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {class: 'hey'}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling no class is set is parent does not give it as prop 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = ctx['props'].class;
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling no class is set is parent does not give it as prop 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
return component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling t-att-class is properly added/removed on widget root el (v2) 1`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<span class=\\"c\\" block-attribute-0=\\"class\\"/>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let d1 = {d:ctx['state'].d,...ctx['props'].class};
|
|
return block1([d1]);
|
|
}
|
|
}"
|
|
`;
|
|
|
|
exports[`style and class handling t-att-class is properly added/removed on widget root el (v2) 2`] = `
|
|
"function anonymous(bdom, helpers
|
|
) {
|
|
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
|
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers;
|
|
|
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
|
|
|
return function template(ctx, node, key = \\"\\") {
|
|
let b2 = component(\`Child\`, {class: {b:ctx['state'].b}}, key + \`__1\`, node, ctx);
|
|
return block1([], [b2]);
|
|
}
|
|
}"
|
|
`;
|