mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-02-06 09:55:47 +00:00
- Add TextViewStatic.spec.tsx (16 tests): static HTML renderer tests - Add TextView.spec.tsx (10 tests): TipTap read-only viewer tests - Add RichTextEditor.spec.tsx (9 tests): editable editor tests - Update setupTest.ts with TipTap DOM mocks (Range, Document APIs) Tests cover rendering, truncation, hashtag/mention styling and clicks, link navigation, and video embed rendering.
27 lines
588 B
TypeScript
27 lines
588 B
TypeScript
// eslint-disable-next-line import-x/no-unassigned-import
|
|
import '@testing-library/jest-dom'
|
|
import { vi } from 'vitest'
|
|
|
|
// TipTap requires Range and Document APIs that happy-dom doesn't fully implement
|
|
Range.prototype.getBoundingClientRect = () => ({
|
|
bottom: 0,
|
|
height: 0,
|
|
left: 0,
|
|
right: 0,
|
|
top: 0,
|
|
width: 0,
|
|
x: 0,
|
|
y: 0,
|
|
toJSON: vi.fn(),
|
|
})
|
|
|
|
Range.prototype.getClientRects = () => ({
|
|
item: () => null,
|
|
length: 0,
|
|
[Symbol.iterator]: vi.fn(),
|
|
})
|
|
|
|
if (typeof Document.prototype.elementFromPoint === 'undefined') {
|
|
Document.prototype.elementFromPoint = vi.fn()
|
|
}
|