This commit is contained in:
Géry Debongnie
2022-06-24 10:32:17 +02:00
parent ca3431e2f9
commit 0f49048616
10 changed files with 208 additions and 141 deletions
+13 -14
View File
@@ -3,10 +3,10 @@ import {
onError,
onMounted,
onPatched,
onWillPatch,
onWillStart,
onWillRender,
onRendered,
onWillPatch,
onWillRender,
onWillStart,
onWillUnmount,
useState,
xml,
@@ -14,8 +14,8 @@ import {
import {
logStep,
makeTestFixture,
nextTick,
nextMicroTick,
nextTick,
snapshotEverything,
useLogLifecycle,
} from "../helpers";
@@ -1251,9 +1251,9 @@ describe("can catch errors", () => {
"Parent:willRender",
"Child:setup",
"Child:willStart",
"Parent:rendered",
"Child:willRender",
"Child:rendered",
"Parent:rendered",
"Child:mounted",
"Parent:mounted",
]).toBeLogged();
@@ -1276,7 +1276,7 @@ describe("can catch errors", () => {
expect(fixture.innerHTML).toBe("2");
});
test("an error in onWillDestroy, variation", async () => {
test.only("an error in onWillDestroy, variation", async () => {
class Child extends Component {
static template = xml`<div>abc</div>`;
setup() {
@@ -1314,27 +1314,26 @@ describe("can catch errors", () => {
]).toBeLogged();
parent.state.hasChild = true;
await nextMicroTick();
await nextMicroTick();
await nextMicroTick();
await nextMicroTick();
await nextMicroTick();
await nextTick();
expect([
"Parent:willRender",
"Child:setup",
"Child:willStart",
"Parent:rendered",
"Child:willRender",
"Child:rendered",
"Parent:rendered",
"Parent:willPatch",
"Child:mounted",
"Parent:patched",
]).toBeLogged();
parent.state.hasChild = false;
await nextTick();
expect([
"Child:willDestroy",
"Parent:willRender",
"Parent:rendered",
"Parent:willPatch",
"Parent:patched",
"Child:willUnmount",
"Child:willDestroy",
]).toBeLogged();
expect(fixture.innerHTML).toBe("2");
});