// @vitest-environment jsdom import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { DesignSystemPreviewModal } from '../../src/components/DesignSystemPreviewModal'; import { I18nProvider } from '../../src/i18n'; import type { DesignSystemSummary } from '../../src/types'; const { fetchDesignSystemShowcaseMock } = vi.hoisted(() => ({ fetchDesignSystemShowcaseMock: vi.fn(async () => '
showcase
'), })); vi.mock('../../src/providers/registry', () => ({ designSystemStaticUrl: (id: string, filePath: string) => `/design-systems/${id}/${filePath}`, fetchDesignSystem: vi.fn(async () => ({ id: 'claymorphism', title: 'Claymorphism', summary: 'Bundled design system', category: 'style', body: '# Claymorphism', })), fetchDesignSystemPreview: vi.fn(async () => 'tokens
'), fetchDesignSystemShowcase: fetchDesignSystemShowcaseMock, fetchProjectFileText: vi.fn(async () => null), openExternalUrl: vi.fn(), projectRawUrl: (projectId: string, filePath: string) => `/raw/${projectId}/${filePath}`, })); const SYSTEM = { id: 'claymorphism', title: 'Claymorphism', summary: 'Bundled design system', category: 'style', source: 'built-in', } as DesignSystemSummary; function renderInsideStackingContext() { const host = document.createElement('div'); host.className = 'composer'; document.body.appendChild(host); render(