// @vitest-environment jsdom import { act, forwardRef, useImperativeHandle, useRef } from "react"; import { createRoot, type Root } from "react-dom/client"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; // Same mock the InlineEditor tests use: the rich markdown editor is not // jsdom-renderable; a textarea keeps the InlineEditor edit-mode contract. vi.mock("@/components/MarkdownEditor", () => ({ MarkdownEditor: forwardRef< { focus: () => void }, { value: string; onChange: (value: string) => void } >(function MarkdownEditorMock(props, ref) { const taRef = useRef(null); useImperativeHandle(ref, () => ({ focus: () => taRef.current?.focus(), })); return (