mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
29a80d0b28
While it is not tested, nor documented, the reference QWeb implementation display the `false` value as "false". So, we have to adapt the Owl implementation to match that behaviour. At the same time, this commit uses 'let' instead of 'var' in various places, to make the compiled code more consistant.
45 lines
1.8 KiB
Plaintext
45 lines
1.8 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`RouteComponent can render simple cases 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"__template__1\\"
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let scope = Object.create(context);
|
|
let result;
|
|
let h = this.h;
|
|
if (scope['routeComponent']) {
|
|
const nodeKey4 = scope['env'].router.currentRouteName;
|
|
// Component 'routeComponent'
|
|
let k6 = \`__6__\` + nodeKey4;
|
|
let w5 = k6 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k6]] : false;
|
|
let vn7 = {};
|
|
result = vn7;
|
|
let props5 = Object.assign({}, scope['env'].router.currentParams);
|
|
if (w5 && w5.__owl__.currentFiber && !w5.__owl__.vnode) {
|
|
w5.destroy();
|
|
w5 = false;
|
|
}
|
|
if (w5) {
|
|
w5.__updateProps(props5, extra.fiber, undefined);
|
|
let pvnode = w5.__owl__.pvnode;
|
|
utils.defineProxy(vn7, pvnode);
|
|
} else {
|
|
let componentKey5 = \`routeComponent\`;
|
|
let W5 = context.constructor.components[componentKey5] || QWeb.components[componentKey5]|| scope['routeComponent'];
|
|
if (!W5) {throw new Error('Cannot find the definition of component \\"' + componentKey5 + '\\"')}
|
|
w5 = new W5(parent, props5);
|
|
parent.__owl__.cmap[k6] = w5.__owl__.id;
|
|
let fiber = w5.__prepare(extra.fiber, undefined, () => { const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
let pvnode = h('dummy', {key: k6, hook: {remove() {},destroy(vn) {w5.destroy();}}});
|
|
utils.defineProxy(vn7, pvnode);
|
|
w5.__owl__.pvnode = pvnode;
|
|
}
|
|
w5.__owl__.parentLastFiberId = extra.fiber.id;
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|