mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
@@ -25,6 +25,7 @@ let env: Env;
|
||||
beforeEach(() => {
|
||||
fixture = makeTestFixture();
|
||||
env = makeTestEnv();
|
||||
env.qweb.addTemplate("Widget", "<div></div>");
|
||||
env.qweb.addTemplate(
|
||||
"Counter",
|
||||
`<div><t t-esc="state.counter"/><button t-on-click="inc">Inc</button></div>`
|
||||
@@ -83,6 +84,19 @@ describe("basic widget properties", () => {
|
||||
expect(fixture.innerHTML).toBe("<div></div>");
|
||||
});
|
||||
|
||||
test("crashes if it cannot find a template", async () => {
|
||||
expect.assertions(1);
|
||||
class SomeWidget extends Component<any, any, any> {}
|
||||
const widget = new SomeWidget(env);
|
||||
try {
|
||||
await widget.mount(fixture);
|
||||
} catch (e) {
|
||||
expect(e.message).toBe(
|
||||
'Could not find template for component "SomeWidget"'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("can be clicked on and updated", async () => {
|
||||
const counter = new Counter(env);
|
||||
await counter.mount(fixture);
|
||||
|
||||
Reference in New Issue
Block a user