mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: fix lifecycle order
This commit is contained in:
committed by
Aaron Bohy
parent
1f6e84d141
commit
af80cefa76
@@ -96,10 +96,10 @@ describe("hooks", () => {
|
||||
await app.mount(fixture);
|
||||
app.destroy();
|
||||
expect(steps).toEqual([
|
||||
"hook:mounted2",
|
||||
"hook:mounted1",
|
||||
"hook:willUnmount1",
|
||||
"hook:mounted2",
|
||||
"hook:willUnmount2",
|
||||
"hook:willUnmount1",
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -939,37 +939,6 @@ describe("lifecycle hooks", () => {
|
||||
expect(created).toBe(true);
|
||||
});
|
||||
|
||||
test.skip("two different call to mounted/willunmount should work", async () => {
|
||||
/*const steps: string[] = [];
|
||||
function useMyHook(i) {
|
||||
onMounted(() => {
|
||||
steps.push("hook:mounted" + i);
|
||||
});
|
||||
onWillUnmount(() => {
|
||||
steps.push("hook:willunmount" + i);
|
||||
});
|
||||
}
|
||||
class MyComponent extends Component {
|
||||
static template = xml`<div>hey</div>`;
|
||||
constructor() {
|
||||
super();
|
||||
useMyHook(1);
|
||||
useMyHook(2);
|
||||
}
|
||||
}
|
||||
const component = new MyComponent();
|
||||
await component.mount(fixture);
|
||||
expect(fixture.innerHTML).toBe("<div>hey</div>");
|
||||
component.unmount();
|
||||
expect(fixture.innerHTML).toBe("");
|
||||
expect(steps).toEqual([
|
||||
"hook:mounted1",
|
||||
"hook:mounted2",
|
||||
"hook:willunmount2",
|
||||
"hook:willunmount1",
|
||||
]);*/
|
||||
});
|
||||
|
||||
// TODO: rename (corresponds to https://github.com/odoo/owl/blob/master/doc/reference/concurrency_model.md#semantics)
|
||||
test("component semantics", async () => {
|
||||
let steps: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user