源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
+95
@@ -0,0 +1,95 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { cleanup, render, screen } from "@testing-library/react";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { AgentMessageBlock } from "./AgentMessageBlock";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe("AgentMessageBlock selected text", () => {
|
||||
it("renders a selected-text message as a compact reference chip", () => {
|
||||
render(
|
||||
<AgentMessageBlock
|
||||
workspaceRoot="/workspace"
|
||||
basePath="/workspace"
|
||||
row={{
|
||||
kind: "message",
|
||||
id: "row-user",
|
||||
turnId: "turn-1",
|
||||
speaker: "user",
|
||||
rawFirstTextBlock: null,
|
||||
messages: [
|
||||
{
|
||||
kind: "message-content",
|
||||
id: "message-user:selected-text",
|
||||
turnId: "turn-1",
|
||||
body: "",
|
||||
presentationKind: "content",
|
||||
contentKind: "selected-text",
|
||||
selectedText: {
|
||||
count: 1,
|
||||
texts: ["Selected source text"]
|
||||
},
|
||||
occurredAtUnixMs: 1
|
||||
}
|
||||
],
|
||||
thinking: [],
|
||||
occurredAtUnixMs: 1
|
||||
}}
|
||||
thinkingLabel="Thinking"
|
||||
/>
|
||||
);
|
||||
|
||||
const chip = screen.getByTestId("agent-selected-text-chip");
|
||||
expect(chip.getAttribute("data-selected-text-count")).toBe("1");
|
||||
expect(chip).toHaveTextContent("1 selected file snippet");
|
||||
expect(chip).toHaveClass("rounded-[10px]");
|
||||
expect(chip).toHaveClass("bg-[var(--background-fronted)]");
|
||||
expect(screen.queryByText("Selected source text")).toBeNull();
|
||||
});
|
||||
|
||||
it("does not expose the selected-text chip as an editable message target", () => {
|
||||
render(
|
||||
<AgentMessageBlock
|
||||
workspaceRoot="/workspace"
|
||||
basePath="/workspace"
|
||||
row={{
|
||||
kind: "message",
|
||||
id: "row-user",
|
||||
turnId: "turn-1",
|
||||
speaker: "user",
|
||||
rawFirstTextBlock: "> Selected source text",
|
||||
messages: [
|
||||
{
|
||||
kind: "message-content",
|
||||
id: "message-user:selected-text",
|
||||
turnId: "turn-1",
|
||||
body: "",
|
||||
presentationKind: "content",
|
||||
contentKind: "selected-text",
|
||||
selectedText: {
|
||||
count: 1,
|
||||
texts: ["Selected source text"]
|
||||
},
|
||||
occurredAtUnixMs: 1
|
||||
}
|
||||
],
|
||||
thinking: [],
|
||||
occurredAtUnixMs: 1
|
||||
}}
|
||||
editRetry={{
|
||||
pending: false,
|
||||
labels: {
|
||||
edit: "Edit message",
|
||||
cancel: "Cancel",
|
||||
submit: "Save and retry"
|
||||
},
|
||||
onSubmit: async () => true
|
||||
}}
|
||||
thinkingLabel="Thinking"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.queryByRole("button", { name: "Edit message" })).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user