From b11a44062563bc327636e472305d0ad5d274b816 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 6 Jul 2023 21:12:20 +0200 Subject: [PATCH] issue render await --- tests/components/concurrency.test.ts | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/components/concurrency.test.ts b/tests/components/concurrency.test.ts index c23ff6dc..d979d662 100644 --- a/tests/components/concurrency.test.ts +++ b/tests/components/concurrency.test.ts @@ -504,6 +504,48 @@ test("update a sub-component twice in the same frame", async () => { ]).toBeLogged(); }); +test.only("abcde", async () => { + class Parent extends Component { + static template = xml``; + state = useState({ x: 1 }); + setup() { + useLogLifecycle(); + } + + async _doIt() { + await Promise.resolve(); + this.state.x++; + } + + async doIt() { + await this._doIt(); + this.state.x++; + } + } + + const parent = await mount(Parent, fixture); + expect([ + "Parent:setup", + "Parent:willStart", + "Parent:willRender", + "Parent:rendered", + "Parent:mounted", + ]).toBeLogged(); + expect(fixture.innerHTML).toBe("1"); + + parent.doIt(); + await nextTick(); + expect([ + "Parent:willRender", + "Parent:rendered", + "Parent:willRender", + "Parent:rendered", + "Parent:willPatch", + "Parent:patched", + ]).toBeLogged(); + expect(fixture.innerHTML).toBe("3"); +}); + test("update a sub-component twice in the same frame, 2", async () => { class ChildA extends Component { static template = xml``;