fix: jsdom doesn't implement Range.prototype.getClientRects
This commit is contained in:
1 parent
28d2d5c826
commit
953be7342d
1 file changed
+5
@@ -12,6 +12,11 @@ vi.mock('@nuxt/ui/composables', () => ({
|
|||||||
useToast: () => ({ add: vi.fn() }),
|
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) {
|
function mockResponse(status: number, body: unknown = null) {
|
||||||
return {
|
return {
|
||||||
ok: status >= 200 && status < 300,
|
ok: status >= 200 && status < 300,
|
||||||
|
|||||||
Reference in new issue
Block a user