mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] qweb: reintroduce t-tag directive
will not be compatible with t-model directive !
This commit is contained in:
committed by
Géry Debongnie
parent
ae71db28e4
commit
ca139166ab
@@ -0,0 +1,128 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`qweb t-tag can fallback if falsy tag 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 'fallback'}/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['tag'];
|
||||
return toggler(tag1, block1(tag1)());
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag can update 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 't'}/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['tag'];
|
||||
return toggler(tag1, block1(tag1)());
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag simple usecases 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 't'}/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = 'div';
|
||||
return toggler(tag1, block1(tag1)());
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag simple usecases 2`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 't'}>text</\${tag || 't'}>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['tag'];
|
||||
return toggler(tag1, block1(tag1)());
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag with multiple attributes 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 't'} class=\\"blueberry\\" taste=\\"raspberry\\">gooseberry</\${tag || 't'}>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['tag'];
|
||||
return toggler(tag1, block1(tag1)());
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag with multiple child nodes 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 't'}> pear <span>apple</span> strawberry </\${tag || 't'}>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['tag'];
|
||||
return toggler(tag1, block1(tag1)());
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag with multiple t-tag in same template 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block1 = tag => createBlock(\`<\${tag || 't'}><block-child-0/></\${tag || 't'}>\`);
|
||||
let block2 = tag => createBlock(\`<\${tag || 't'}>baz</\${tag || 't'}>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['outer'];
|
||||
let tag2 = ctx['inner'];
|
||||
let b2 = toggler(tag2, block2(tag2)());
|
||||
return toggler(tag1, block1(tag1)([], [b2]));
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`qweb t-tag with multiple t-tag in same template, part 2 1`] = `
|
||||
"function anonymous(bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, component } = bdom;
|
||||
let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber } = helpers;
|
||||
|
||||
let block2 = tag => createBlock(\`<\${tag || 't'}>bar</\${tag || 't'}>\`);
|
||||
let block3 = tag => createBlock(\`<\${tag || 't'}>baz</\${tag || 't'}>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let tag1 = ctx['brother'];
|
||||
let b2 = toggler(tag1, block2(tag1)());
|
||||
let tag2 = ctx['brother'];
|
||||
let b3 = toggler(tag2, block3(tag2)());
|
||||
return multi([b2, b3]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
Reference in New Issue
Block a user