mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: do not validate props twice
it is not useful to do it in the component directive, especially since it is done in the constructor, and the default props are not applied. closes #379
This commit is contained in:
@@ -352,4 +352,22 @@ describe("default props", () => {
|
||||
expect(w.props.p).toBe(4);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("can set default required boolean values", async () => {
|
||||
class TestWidget extends Widget {
|
||||
static props = ["p", "q"];
|
||||
static defaultProps = { p: true, q: false };
|
||||
static template = xml`<span><t t-if="props.p">hey</t><t t-if="!props.q">hey</t></span>`;
|
||||
}
|
||||
|
||||
class App extends Widget {
|
||||
static template = xml`<div><TestWidget/></div>`;
|
||||
static components = { TestWidget };
|
||||
}
|
||||
|
||||
const w = new App(env, {});
|
||||
await w.mount(fixture);
|
||||
expect(fixture.innerHTML).toBe('<div><span>heyhey</span></div>')
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user