mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
naive implementation of mounted hook
This commit is contained in:
@@ -91,6 +91,21 @@ describe("lifecycle hooks", () => {
|
||||
await widget.mount(target);
|
||||
expect(mounted).toBe(false);
|
||||
});
|
||||
|
||||
test("mounted hook is called if mounted in DOM", async () => {
|
||||
let mounted = false;
|
||||
class HookWidget extends Widget {
|
||||
async mounted() {
|
||||
mounted = true;
|
||||
}
|
||||
}
|
||||
const widget = makeWidget(HookWidget);
|
||||
const target = document.createElement("div");
|
||||
document.body.appendChild(target);
|
||||
await widget.mount(target);
|
||||
expect(mounted).toBe(true);
|
||||
target.remove()
|
||||
});
|
||||
});
|
||||
|
||||
describe("destroy method", () => {
|
||||
|
||||
Reference in New Issue
Block a user