Skip to content

Commit c7e093f

Browse files
docs(unit-test): stub visualViewport to prevent crashes in JSDOM (#21984)
Resolves #21692
1 parent bdd3129 commit c7e093f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import { afterEach } from 'vitest'
1+
import { afterEach, vi } from 'vitest'
22
import { cleanup } from '@testing-library/vue'
33

4+
// Stub visualViewport so Vuetify components (e.g. VMenu) don't crash in JSDOM
5+
if (!globalThis.visualViewport) {
6+
vi.stubGlobal('visualViewport', new EventTarget())
7+
}
8+
49
afterEach(() => {
510
cleanup()
611
})

0 commit comments

Comments
 (0)