fix: jsdom doesn't implement Range.prototype.getClientRects

This commit is contained in:
fsylvain committed 2026-10-07 16:51:57 +02:00
1 parent 28d2d5c826
commit 953be7342d
1 file changed
+5
@@ -12,6 +12,11 @@ vi.mock('@nuxt/ui/composables', () => ({
useToast: () => ({ add: vi.fn() }),
}))
const emptyRectList = () => Object.assign([], { item: () => null }) as unknown as DOMRectList
Range.prototype.getClientRects = emptyRectList
Range.prototype.getBoundingClientRect = () => new DOMRect()
function mockResponse(status: number, body: unknown = null) {
return {
ok: status >= 200 && status < 300,