feat(app): copy terminal IDs from tab menus (#2371)
This commit is contained in:
@@ -34,6 +34,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-context-agent_123",
|
||||
onCopyResumeCommand,
|
||||
onCopyAgentId,
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath,
|
||||
onReloadAgent,
|
||||
onRenameTab,
|
||||
@@ -64,6 +65,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-menu-agent_123",
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab: vi.fn(),
|
||||
@@ -99,6 +101,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-menu-draft_123",
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab: vi.fn(),
|
||||
@@ -127,6 +130,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-context-agent_123",
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab: vi.fn(),
|
||||
@@ -156,6 +160,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-context-agent_123",
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab,
|
||||
@@ -174,8 +179,9 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
expect(onRenameTab).toHaveBeenCalledWith(tab);
|
||||
});
|
||||
|
||||
it("includes rename as the first entry for terminal tabs", () => {
|
||||
it("includes copy id and rename for terminal tabs", () => {
|
||||
const onRenameTab = vi.fn();
|
||||
const onCopyTerminalId = vi.fn();
|
||||
const terminalTab: WorkspaceTabDescriptor = {
|
||||
key: "terminal_abc",
|
||||
tabId: "terminal_abc",
|
||||
@@ -190,6 +196,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-context-terminal_abc",
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId,
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab,
|
||||
@@ -200,12 +207,22 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
});
|
||||
|
||||
const labels = entries.filter((entry) => entry.kind === "item").map((entry) => entry.label);
|
||||
expect(labels[0]).toBe("Rename");
|
||||
expect(labels[0]).toBe("Copy terminal id");
|
||||
expect(labels[1]).toBe("Rename");
|
||||
expect(labels).not.toContain("Copy resume command");
|
||||
expect(labels).not.toContain("Copy agent id");
|
||||
expect(labels).not.toContain("Copy file path");
|
||||
expect(labels).not.toContain("Reload agent");
|
||||
|
||||
const copyTerminalIdEntry = entries.find(
|
||||
(entry) => entry.kind === "item" && entry.key === "copy-terminal-id",
|
||||
);
|
||||
if (!copyTerminalIdEntry || copyTerminalIdEntry.kind !== "item") {
|
||||
throw new Error("Copy terminal id entry missing");
|
||||
}
|
||||
copyTerminalIdEntry.onSelect();
|
||||
expect(onCopyTerminalId).toHaveBeenCalledWith("terminal-abc");
|
||||
|
||||
const renameEntry = entries.find((entry) => entry.kind === "item" && entry.label === "Rename");
|
||||
if (!renameEntry || renameEntry.kind !== "item") {
|
||||
throw new Error("Rename entry missing");
|
||||
@@ -230,6 +247,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase: "workspace-tab-context-file_abc",
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath,
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab: vi.fn(),
|
||||
@@ -272,6 +290,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
tabCount: 1,
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab: vi.fn(),
|
||||
@@ -302,6 +321,7 @@ describe("buildWorkspaceTabMenuEntries", () => {
|
||||
menuTestIDBase,
|
||||
onCopyResumeCommand: vi.fn(),
|
||||
onCopyAgentId: vi.fn(),
|
||||
onCopyTerminalId: vi.fn(),
|
||||
onCopyFilePath: vi.fn(),
|
||||
onReloadAgent: vi.fn(),
|
||||
onRenameTab: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user