From d2c21c3bb72904b3c32d5219523e52bce4af0d6b Mon Sep 17 00:00:00 2001 From: margrop <1731827+margrop@users.noreply.github.com> Date: Sat, 5 Dec 2026 00:59:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=AA=E8=AF=BB?= =?UTF-8?q?=E5=8D=A1=E7=89=87AI=E6=93=8D=E4=BD=9C=E6=9C=AA=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E4=B8=8E=E6=89=8B=E6=9C=BA=E7=AB=AF=E6=A0=A1=E5=AF=B9?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=A0=8F=E8=A2=AB=E5=AF=BC=E8=88=AA=E9=81=AE?= =?UTF-8?q?=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unit/markdown-field-card.test.tsx | 81 +++++++++++++++++++ src/components/correction-editor.tsx | 4 +- .../error-detail/markdown-field-card.tsx | 2 +- 3 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 src/__tests__/unit/markdown-field-card.test.tsx diff --git a/src/__tests__/unit/markdown-field-card.test.tsx b/src/__tests__/unit/markdown-field-card.test.tsx new file mode 100644 index 00000000..7e2c1463 --- /dev/null +++ b/src/__tests__/unit/markdown-field-card.test.tsx @@ -0,0 +1,81 @@ +// @vitest-environment jsdom +/** + * MarkdownFieldCard:只读成员隐藏编辑按钮与标题栏写操作,同时保留折叠切换 + */ +import { act } from "react"; +import { createRoot } from "react-dom/client"; +import type { Root } from "react-dom/client"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { MarkdownFieldCard } from "@/components/error-detail/markdown-field-card"; +import { LanguageProvider } from "@/contexts/LanguageContext"; + +vi.mock("@/components/markdown-renderer", () => ({ + MarkdownRenderer: ({ content }: { content?: string | null }) =>
{content}
, +})); + +vi.mock("@/components/markdown-editor", () => ({ + MarkdownEditor: ({ value, onChange }: { value: string; onChange: (v: string) => void }) => ( +