mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] hooks: useSubEnv will not erase previous useChildSubEnv
This commit is contained in:
@@ -322,6 +322,24 @@ describe("hooks", () => {
|
||||
expect(fixture.innerHTML).toBe("3<div>5</div>");
|
||||
});
|
||||
|
||||
test("parent and child env (with useChildSubEnv then useSubEnv)", async () => {
|
||||
class Child extends Component {
|
||||
static template = xml`<div t-if="env.hasParent"><t t-esc="env.val"/></div>`;
|
||||
}
|
||||
|
||||
class Parent extends Component {
|
||||
static template = xml`<t t-esc="env.val"/><Child/>`;
|
||||
static components = { Child };
|
||||
setup() {
|
||||
useChildSubEnv({ hasParent: true });
|
||||
useSubEnv({ val: 5 });
|
||||
}
|
||||
}
|
||||
const env = { val: 3 };
|
||||
await mount(Parent, fixture, { env });
|
||||
expect(fixture.innerHTML).toBe("5<div>5</div>");
|
||||
});
|
||||
|
||||
test("can use onWillStart, onWillUpdateProps", async () => {
|
||||
const steps: string[] = [];
|
||||
async function slow(): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user