diff --git a/webview-ui/src/components/chat/TaskActions.tsx b/webview-ui/src/components/chat/TaskActions.tsx index 01340de475d..603b6be3e0c 100644 --- a/webview-ui/src/components/chat/TaskActions.tsx +++ b/webview-ui/src/components/chat/TaskActions.tsx @@ -23,18 +23,16 @@ export const TaskActions = ({ item, buttonsDisabled }: TaskActionsProps) => { return (
- + vscode.postMessage({ type: "exportCurrentTask" })} /> {item?.task && ( copyWithFeedback(item.task, e)} /> )} diff --git a/webview-ui/src/components/chat/__tests__/TaskActions.spec.tsx b/webview-ui/src/components/chat/__tests__/TaskActions.spec.tsx index 5db62877479..68c564f8239 100644 --- a/webview-ui/src/components/chat/__tests__/TaskActions.spec.tsx +++ b/webview-ui/src/components/chat/__tests__/TaskActions.spec.tsx @@ -371,16 +371,54 @@ describe("TaskActions", () => { }) describe("Button States", () => { - it("disables buttons when buttonsDisabled is true", () => { + it("keeps share, export, and copy buttons enabled but disables delete button when buttonsDisabled is true", () => { render() - // Find button by its icon class + // Find buttons by their labels/icons const buttons = screen.getAllByRole("button") const shareButton = buttons.find((btn) => btn.querySelector(".codicon-link")) const exportButton = screen.getByLabelText("Export task history") + const copyButton = buttons.find((btn) => btn.querySelector(".codicon-copy")) + const deleteButton = screen.getByLabelText("Delete Task (Shift + Click to skip confirmation)") - expect(shareButton).toBeDisabled() - expect(exportButton).toBeDisabled() + // Share, export, and copy buttons should be enabled regardless of buttonsDisabled + expect(shareButton).not.toBeDisabled() + expect(exportButton).not.toBeDisabled() + expect(copyButton).not.toBeDisabled() + // Delete button should respect buttonsDisabled + expect(deleteButton).toBeDisabled() + }) + + it("share, export, and copy buttons are always enabled while delete button respects buttonsDisabled state", () => { + // Test with buttonsDisabled = false + const { rerender } = render() + + let buttons = screen.getAllByRole("button") + let shareButton = buttons.find((btn) => btn.querySelector(".codicon-link")) + let exportButton = screen.getByLabelText("Export task history") + let copyButton = buttons.find((btn) => btn.querySelector(".codicon-copy")) + let deleteButton = screen.getByLabelText("Delete Task (Shift + Click to skip confirmation)") + + expect(shareButton).not.toBeDisabled() + expect(exportButton).not.toBeDisabled() + expect(copyButton).not.toBeDisabled() + expect(deleteButton).not.toBeDisabled() + + // Test with buttonsDisabled = true + rerender() + + buttons = screen.getAllByRole("button") + shareButton = buttons.find((btn) => btn.querySelector(".codicon-link")) + exportButton = screen.getByLabelText("Export task history") + copyButton = buttons.find((btn) => btn.querySelector(".codicon-copy")) + deleteButton = screen.getByLabelText("Delete Task (Shift + Click to skip confirmation)") + + // Share, export, and copy remain enabled + expect(shareButton).not.toBeDisabled() + expect(exportButton).not.toBeDisabled() + expect(copyButton).not.toBeDisabled() + // Delete button is disabled + expect(deleteButton).toBeDisabled() }) }) })