mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] component: improve render method
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`default props default values are also set whenever component is updated 1`] = `"<div>1</div>"`;
|
||||
|
||||
exports[`default props default values are also set whenever component is updated 2`] = `"<div>4</div>"`;
|
||||
|
||||
exports[`props validation props are validated in dev mode (code snapshot) 1`] = `
|
||||
"function anonymous(context,extra
|
||||
) {
|
||||
|
||||
@@ -327,9 +327,17 @@ describe("default props", () => {
|
||||
class TestWidget extends Widget {
|
||||
static defaultProps = { p: 4 };
|
||||
}
|
||||
env.qweb.addTemplates(`
|
||||
<templates>
|
||||
<div t-name="TestWidget"><t t-esc="props.p"/></div>
|
||||
</templates>`);
|
||||
|
||||
const w = new TestWidget(env, { p: 1 });
|
||||
await w.mount(fixture);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
await w.__updateProps({});
|
||||
await w.render();
|
||||
expect(w.props.p).toBe(4);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user