[IMP] component: display better error message if render is empty

closes #446
This commit is contained in:
Géry Debongnie
2019-11-14 15:33:45 +01:00
parent 4aea093ed9
commit 54e1734f2f
3 changed files with 23 additions and 10 deletions
+15
View File
@@ -108,6 +108,21 @@ describe("basic widget properties", () => {
);
});
test("display an error message if result of rendering is empty", async () => {
class SomeWidget extends Component<any, any> {
static template = xml`<t/>`;
}
const widget = new SomeWidget();
let error;
try {
await widget.mount(fixture);
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toBe("Rendering 'SomeWidget' did not return anything");
});
test("crashes if it cannot find a template", async () => {
expect.assertions(1);
class SomeWidget extends Component<any, any> {}