fix(webui): stop repairing completed Markdown

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-30 15:50:27 +08:00
1 parent fc3effe39d
commit 450a85fe0e
6 files changed
+48 -7

No files matched your search

+10 -1
View File
@@ -13,10 +13,12 @@ vi.mock("@/components/MarkdownTextRenderer", () => ({
children,
highlightCode,
streaming,
preserveStreamingLayout,
}: {
children: string;
highlightCode?: boolean;
streaming?: boolean;
preserveStreamingLayout?: boolean;
}) {
useEffect(() => {
rendererMountSpy();
@@ -29,7 +31,8 @@ vi.mock("@/components/MarkdownTextRenderer", () => ({
<div
data-testid="markdown-renderer"
data-highlight-code={String(highlightCode)}
data-streaming-layout={String(streaming)}
data-streaming-layout={String(streaming || preserveStreamingLayout)}
data-streaming={String(streaming)}
>
{children}
</div>
@@ -108,6 +111,7 @@ describe("MarkdownText", () => {
});
it("can complete without replacing the streaming renderer layout", async () => {
rendererMountSpy.mockClear();
const source = "A layout-stable answer";
const { rerender } = render(
<MarkdownText streaming preserveStreamingLayout>{source}</MarkdownText>,
@@ -122,8 +126,13 @@ describe("MarkdownText", () => {
"true",
);
expect(screen.getByTestId("markdown-renderer")).toHaveAttribute("data-streaming", "true");
rerender(<MarkdownText preserveStreamingLayout>{source}</MarkdownText>);
expect(screen.getByTestId("markdown-renderer")).toHaveAttribute("data-streaming", "false");
expect(rendererMountSpy).toHaveBeenCalledTimes(1);
expect(screen.getByTestId("markdown-renderer")).toHaveAttribute(
"data-streaming-layout",
"true",