mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(ImagePreview): fix incorrect onClose test case (#12386)
This commit is contained in:
parent
0fc4f07704
commit
8a7f8d7aa5
@ -12,13 +12,16 @@ test('should allow to use the teleport option', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should trigger onClose option correctly', async () => {
|
test('should trigger onClose option correctly', async () => {
|
||||||
|
const root = document.createElement('div');
|
||||||
const onClose = vi.fn();
|
const onClose = vi.fn();
|
||||||
const instance = showImagePreview({
|
const instance = showImagePreview({
|
||||||
images,
|
images,
|
||||||
startPosition: 1,
|
startPosition: 1,
|
||||||
onClose,
|
onClose,
|
||||||
|
teleport: root,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await later();
|
||||||
await instance?.close();
|
await instance?.close();
|
||||||
|
|
||||||
expect(onClose).toHaveBeenCalledTimes(1);
|
expect(onClose).toHaveBeenCalledTimes(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user