From 8a7f8d7aa56d93f8f38a9404f308df17228d6e31 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 23 Oct 2023 17:54:19 +0800 Subject: [PATCH] test(ImagePreview): fix incorrect onClose test case (#12386) --- packages/vant/src/image-preview/test/function-call.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vant/src/image-preview/test/function-call.spec.ts b/packages/vant/src/image-preview/test/function-call.spec.ts index 61d1a56f9..d8a577bef 100644 --- a/packages/vant/src/image-preview/test/function-call.spec.ts +++ b/packages/vant/src/image-preview/test/function-call.spec.ts @@ -12,13 +12,16 @@ test('should allow to use the teleport option', async () => { }); test('should trigger onClose option correctly', async () => { + const root = document.createElement('div'); const onClose = vi.fn(); const instance = showImagePreview({ images, startPosition: 1, onClose, + teleport: root, }); + await later(); await instance?.close(); expect(onClose).toHaveBeenCalledTimes(1);