mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: make sure props are validated in all cases
closes #379
This commit is contained in:
committed by
Aaron Bohy
parent
9779cd196c
commit
4ebe419c56
@@ -322,6 +322,28 @@ describe("props validation", () => {
|
||||
QWeb.utils.validateProps(TestWidget, { message: null });
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
test("can set default required boolean values", async () => {
|
||||
class TestWidget extends Widget {
|
||||
static props = ["p"];
|
||||
static template = xml`<span><t t-if="props.p">hey</t></span>`;
|
||||
}
|
||||
|
||||
class App extends Widget {
|
||||
static template = xml`<div><TestWidget/></div>`;
|
||||
static components = { TestWidget };
|
||||
}
|
||||
|
||||
const w = new App(env, {});
|
||||
let error;
|
||||
try {
|
||||
await w.mount(fixture);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
expect(error).toBeDefined();
|
||||
expect(error.message).toBe("Missing props 'p' (component 'TestWidget')");
|
||||
});
|
||||
});
|
||||
|
||||
describe("default props", () => {
|
||||
|
||||
Reference in New Issue
Block a user