fix: guard blocknote popover references

This commit is contained in:
lucaronin
2026-04-30 01:20:12 +02:00
parent 54d53b882f
commit 2e40945c2d
3 changed files with 37 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
import { describe, expect, it } from 'vitest'
import { getMountedBoundingClientRectCache } from '@blocknote/react'
describe('patched BlockNote popover references', () => {
it('uses the virtual rect when a remounting suggestion menu has no DOM element', () => {
const fallbackRect = new DOMRect(4, 8, 16, 24)
const readRect = getMountedBoundingClientRectCache({
element: undefined,
getBoundingClientRect: () => fallbackRect,
} as never)
expect(() => readRect()).not.toThrow()
expect(readRect()).toBe(fallbackRect)
})
})