[IMP] component: components key is now static

This is a breaking change!

closes #279
This commit is contained in:
Géry Debongnie
2019-09-10 22:37:08 +02:00
parent 2a40907e35
commit e1acf66143
16 changed files with 548 additions and 530 deletions
@@ -39,7 +39,7 @@ exports[`async rendering delayed component with t-asyncroot directive 1`] = `
}
if (!w8) {
let componentKey8 = \`Child\`;
let W8 = context.components && context.components[componentKey8] || QWeb.components[componentKey8];
let W8 = context.constructor.components[componentKey8] || QWeb.components[componentKey8];
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
w8 = new W8(parent, props8);
parent.__owl__.cmap[8] = w8.__owl__.id;
@@ -67,7 +67,7 @@ exports[`async rendering delayed component with t-asyncroot directive 1`] = `
}
if (!w11) {
let componentKey11 = \`AsyncChild\`;
let W11 = context.components && context.components[componentKey11] || QWeb.components[componentKey11];
let W11 = context.constructor.components[componentKey11] || QWeb.components[componentKey11];
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
w11 = new W11(parent, props11);
parent.__owl__.cmap[11] = w11.__owl__.id;
@@ -122,7 +122,7 @@ exports[`async rendering fast component with t-asyncroot directive 1`] = `
}
if (!w8) {
let componentKey8 = \`Child\`;
let W8 = context.components && context.components[componentKey8] || QWeb.components[componentKey8];
let W8 = context.constructor.components[componentKey8] || QWeb.components[componentKey8];
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
w8 = new W8(parent, props8);
parent.__owl__.cmap[8] = w8.__owl__.id;
@@ -149,7 +149,7 @@ exports[`async rendering fast component with t-asyncroot directive 1`] = `
}
if (!w11) {
let componentKey11 = \`AsyncChild\`;
let W11 = context.components && context.components[componentKey11] || QWeb.components[componentKey11];
let W11 = context.constructor.components[componentKey11] || QWeb.components[componentKey11];
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
w11 = new W11(parent, props11);
parent.__owl__.cmap[11] = w11.__owl__.id;
@@ -203,7 +203,7 @@ exports[`async rendering t-component with t-asyncroot directive: mixed re-render
}
if (!w8) {
let componentKey8 = \`Child\`;
let W8 = context.components && context.components[componentKey8] || QWeb.components[componentKey8];
let W8 = context.constructor.components[componentKey8] || QWeb.components[componentKey8];
if (!W8) {throw new Error('Cannot find the definition of component \\"' + componentKey8 + '\\"')}
w8 = new W8(parent, props8);
parent.__owl__.cmap[8] = w8.__owl__.id;
@@ -231,7 +231,7 @@ exports[`async rendering t-component with t-asyncroot directive: mixed re-render
}
if (!w11) {
let componentKey11 = \`AsyncChild\`;
let W11 = context.components && context.components[componentKey11] || QWeb.components[componentKey11];
let W11 = context.constructor.components[componentKey11] || QWeb.components[componentKey11];
if (!W11) {throw new Error('Cannot find the definition of component \\"' + componentKey11 + '\\"')}
w11 = new W11(parent, props11);
parent.__owl__.cmap[11] = w11.__owl__.id;
@@ -273,7 +273,7 @@ exports[`class and style attributes with t-component dynamic t-att-style is prop
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -317,7 +317,7 @@ exports[`class and style attributes with t-component t-att-class is properly add
}
if (!w4) {
let componentKey4 = \`Child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -375,7 +375,7 @@ exports[`class and style attributes with t-component t-att-class is properly add
}
if (!w4) {
let componentKey4 = \`Child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -431,7 +431,7 @@ exports[`class and style attributes with t-component t-att-class is properly add
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -474,7 +474,7 @@ exports[`composition sub components dom state with t-keepalive is preserved 1`]
}
if (!w4) {
let componentKey4 = \`InputWidget\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -533,7 +533,7 @@ exports[`composition sub components with some state rendered in a loop 1`] = `
}
if (!w7) {
let componentKey7 = \`ChildWidget\`;
let W7 = context.components && context.components[componentKey7] || QWeb.components[componentKey7];
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7];
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
w7 = new W7(parent, props7);
parent.__owl__.cmap[templateId9] = w7.__owl__.id;
@@ -575,7 +575,7 @@ exports[`composition t-component with dynamic value 1`] = `
}
if (!w4) {
let componentKey4 = (context['state'].widget);
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -616,7 +616,7 @@ exports[`composition t-component with dynamic value 2 1`] = `
}
if (!w4) {
let componentKey4 = \`Widget\${context['state'].widget}\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -658,7 +658,7 @@ exports[`lifecycle hooks willPatch/patched hook with t-keepalive 1`] = `
}
if (!w4) {
let componentKey4 = \`ChildWidget\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -700,7 +700,7 @@ exports[`other directives with t-component t-on with handler bound to argument 1
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -741,7 +741,7 @@ exports[`other directives with t-component t-on with handler bound to empty obje
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -782,7 +782,7 @@ exports[`other directives with t-component t-on with handler bound to empty obje
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -823,7 +823,7 @@ exports[`other directives with t-component t-on with handler bound to object 1`]
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -864,7 +864,7 @@ exports[`other directives with t-component t-on with prevent and self modifiers
}
if (!w4) {
let componentKey4 = \`Child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -905,7 +905,7 @@ exports[`other directives with t-component t-on with self and prevent modifiers
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -946,7 +946,7 @@ exports[`other directives with t-component t-on with self modifier 1`] = `
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -987,7 +987,7 @@ exports[`other directives with t-component t-on with stop and/or prevent modifie
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -1030,7 +1030,7 @@ exports[`random stuff/miscellaneous snapshotting compiled code 1`] = `
}
if (!w4) {
let componentKey4 = \`child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[templateId6] = w4.__owl__.id;
@@ -1089,7 +1089,7 @@ exports[`random stuff/miscellaneous t-on with handler bound to dynamic argument
}
if (!w7) {
let componentKey7 = \`Child\`;
let W7 = context.components && context.components[componentKey7] || QWeb.components[componentKey7];
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7];
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
w7 = new W7(parent, props7);
parent.__owl__.cmap[templateId9] = w7.__owl__.id;
@@ -1306,7 +1306,7 @@ exports[`t-slot directive can define and call slots 1`] = `
}
if (!w4) {
let componentKey4 = \`Dialog\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
w4 = new W4(parent, props4);
parent.__owl__.cmap[4] = w4.__owl__.id;
@@ -1545,7 +1545,7 @@ exports[`t-slot directive slots are rendered with proper context, part 2 2`] = `
}
if (!w9) {
let componentKey9 = \`Link\`;
let W9 = context.components && context.components[componentKey9] || QWeb.components[componentKey9];
let W9 = context.constructor.components[componentKey9] || QWeb.components[componentKey9];
if (!W9) {throw new Error('Cannot find the definition of component \\"' + componentKey9 + '\\"')}
w9 = new W9(parent, props9);
parent.__owl__.cmap[templateId10] = w9.__owl__.id;
@@ -1648,7 +1648,7 @@ exports[`t-slot directive slots are rendered with proper context, part 3 2`] = `
}
if (!w10) {
let componentKey10 = \`Link\`;
let W10 = context.components && context.components[componentKey10] || QWeb.components[componentKey10];
let W10 = context.constructor.components[componentKey10] || QWeb.components[componentKey10];
if (!W10) {throw new Error('Cannot find the definition of component \\"' + componentKey10 + '\\"')}
w10 = new W10(parent, props10);
parent.__owl__.cmap[templateId11] = w10.__owl__.id;
@@ -1705,7 +1705,7 @@ exports[`t-slot directive slots are rendered with proper context, part 4 1`] = `
}
if (!w5) {
let componentKey5 = \`Link\`;
let W5 = context.components && context.components[componentKey5] || QWeb.components[componentKey5];
let W5 = context.constructor.components[componentKey5] || QWeb.components[componentKey5];
if (!W5) {throw new Error('Cannot find the definition of component \\"' + componentKey5 + '\\"')}
w5 = new W5(parent, props5);
parent.__owl__.cmap[5] = w5.__owl__.id;
@@ -1759,7 +1759,7 @@ exports[`top level sub widgets basic use 1`] = `
}
if (!w3) {
let componentKey3 = \`Child\`;
let W3 = context.components && context.components[componentKey3] || QWeb.components[componentKey3];
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3];
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
w3 = new W3(parent, props3);
parent.__owl__.cmap[3] = w3.__owl__.id;
@@ -1800,7 +1800,7 @@ exports[`top level sub widgets can select a sub widget 1`] = `
}
if (!w3) {
let componentKey3 = \`Child\`;
let W3 = context.components && context.components[componentKey3] || QWeb.components[componentKey3];
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3];
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
w3 = new W3(parent, props3);
parent.__owl__.cmap[3] = w3.__owl__.id;
@@ -1829,7 +1829,7 @@ exports[`top level sub widgets can select a sub widget 1`] = `
}
if (!w7) {
let componentKey7 = \`OtherChild\`;
let W7 = context.components && context.components[componentKey7] || QWeb.components[componentKey7];
let W7 = context.constructor.components[componentKey7] || QWeb.components[componentKey7];
if (!W7) {throw new Error('Cannot find the definition of component \\"' + componentKey7 + '\\"')}
w7 = new W7(parent, props7);
parent.__owl__.cmap[7] = w7.__owl__.id;
@@ -30,7 +30,7 @@ exports[`props validation props are validated in dev mode (code snapshot) 1`] =
}
if (!w4) {
let componentKey4 = \`Child\`;
let W4 = context.components && context.components[componentKey4] || QWeb.components[componentKey4];
let W4 = context.constructor.components[componentKey4] || QWeb.components[componentKey4];
if (!W4) {throw new Error('Cannot find the definition of component \\"' + componentKey4 + '\\"')}
utils.validateProps(W4, props4)
w4 = new W4(parent, props4);