Skip to content

Commit b4d614c

Browse files
committed
test: update tests
1 parent f5bcf36 commit b4d614c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/core/src/editor/BlockNoteEditor.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ it("block prop types", () => {
104104
}
105105
});
106106

107-
it("onMount and onUnmount", () => {
107+
it("onMount and onUnmount", async () => {
108108
const editor = BlockNoteEditor.create();
109109
let mounted = false;
110110
let unmounted = false;
@@ -118,6 +118,10 @@ it("onMount and onUnmount", () => {
118118
expect(mounted).toBe(true);
119119
expect(unmounted).toBe(false);
120120
editor.unmount();
121+
// expect the unmount event to not have been triggered yet, since it waits 2 ticks
122+
expect(unmounted).toBe(false);
123+
// wait 3 ticks to ensure the unmount event is triggered
124+
await new Promise((resolve) => setTimeout(resolve, 3));
121125
expect(mounted).toBe(true);
122126
expect(unmounted).toBe(true);
123127
});

0 commit comments

Comments
 (0)