[FIX] component: error handling: rendering with sub components

Closes #425
This commit is contained in:
Aaron Bohy
2019-10-30 11:35:28 +01:00
committed by aab-odoo
parent fa6801b523
commit 9e37b968e8
6 changed files with 41 additions and 13 deletions
+20
View File
@@ -4739,6 +4739,26 @@ describe("component error handling (catchError)", () => {
expect(console.error).toBeCalledTimes(0);
console.error = consoleError;
});
test("a rendering error will reject the render promise (with sub components)", async () => {
class Child extends Component<any, any> {
static template = xml`<span></span>`;
}
class Parent extends Component<any, any> {
static template = xml`<div><Child/><t t-esc="x.y"/></div>`;
static components = { Child };
}
let error;
try {
const parent = new Parent(env);
await parent.mount(fixture);
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toBe("Cannot read property 'y' of undefined");
});
});
describe("top level sub widgets", () => {