// @vitest-environment jsdom import type { ReactElement } from 'react'; import { describe, expect, it } from 'vitest'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom/vitest'; import { htmlRenderer } from '../html'; import type { RenderCtx } from '../types'; const baseCtx: RenderCtx = { contentType: 'text/html', url: 'https://example.com/page.html', }; const HTML_BODY = '

Hello

'; const renderHtml = (view: 'preview' | 'raw', body = HTML_BODY) => render(htmlRenderer.render({ view, body, ctx: baseCtx }) as ReactElement); const getIframe = (container: HTMLElement): HTMLIFrameElement => { const iframe = container.querySelector('iframe'); if (!iframe) throw new Error('expected an