// @vitest-environment jsdom import { fireEvent, render, screen, waitFor, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import type { ReactNode } from "react"; import { MemoryRouter } from "react-router-dom"; import { afterEach, describe, expect, it, vi } from "vitest"; import { createTechLogFeatureInstalledInput } from "../../../src/features/tech-log/adapters/create-tech-log-feature-input.ts"; import { MOCK_STUDIO_INSTALL_CONTEXT } from "../../helpers/studio-install-context.ts"; import { FIXTURE_IDS } from "../../../src/features/tech-log/adapters/mock/fixtures.ts"; import type { StudioGateway } from "../../../src/features/tech-log/application/ports/studio-gateway.ts"; import { DocumentEditorScreen } from "../../../src/features/tech-log/presentation/studio/components/document-editor-screen.tsx"; import { StudioProvider } from "../../../src/features/tech-log/presentation/studio/studio-provider.tsx"; import { createManagementGatewayStub } from "../../helpers/management-gateway-stub.ts"; afterEach(() => vi.restoreAllMocks()); function renderEditor( documentId: string, gateway: StudioGateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT).input.createStudioGateway(), ) { // CASE editors mount the Asset Picker (Task 10), which uses the throwing // `useStudioAssetGateway()` accessor -- a test harness that renders it must // supply `createAssetGateway`, the same as `StudioShell` always does. const assetGateway = createTechLogFeatureInstalledInput(MOCK_STUDIO_INSTALL_CONTEXT) .input.createStudioAssetGateway(); return render( gateway} createAssetGateway={() => assetGateway}> , ); } function labelsIn(container: HTMLElement, selector: string): string[] { return Array.from( container.querySelectorAll(selector), // 칸 이름은 보통 `