Skip to content

Commit 38e3553

Browse files
committed
fix: enable export, share, and copy buttons during API operations
- Export, share, and copy buttons now remain enabled when API is active - Delete button still respects buttonsDisabled state for safety - Removed unnecessary exportAlwaysEnabled prop - Updated tests to reflect new behavior
1 parent a28e66a commit 38e3553

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

webview-ui/src/components/chat/TaskActions.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const TaskActions = ({ item, buttonsDisabled }: TaskActionsProps) => {
2323

2424
return (
2525
<div className="flex flex-row gap-1">
26-
<ShareButton item={item} disabled={buttonsDisabled} />
26+
<ShareButton item={item} disabled={false} />
2727
<IconButton
2828
iconClass="codicon-desktop-download"
2929
title={t("chat:task.export")}
@@ -33,7 +33,6 @@ export const TaskActions = ({ item, buttonsDisabled }: TaskActionsProps) => {
3333
<IconButton
3434
iconClass={showCopyFeedback ? "codicon-check" : "codicon-copy"}
3535
title={t("history:copyPrompt")}
36-
disabled={buttonsDisabled}
3736
onClick={(e) => copyWithFeedback(item.task, e)}
3837
/>
3938
)}

webview-ui/src/components/chat/__tests__/TaskActions.spec.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,29 +371,54 @@ describe("TaskActions", () => {
371371
})
372372

373373
describe("Button States", () => {
374-
it("disables share button but keeps export button enabled when buttonsDisabled is true", () => {
374+
it("keeps share, export, and copy buttons enabled but disables delete button when buttonsDisabled is true", () => {
375375
render(<TaskActions item={mockItem} buttonsDisabled={true} />)
376376

377-
// Find button by its icon class
377+
// Find buttons by their labels/icons
378378
const buttons = screen.getAllByRole("button")
379379
const shareButton = buttons.find((btn) => btn.querySelector(".codicon-link"))
380380
const exportButton = screen.getByLabelText("Export task history")
381+
const copyButton = buttons.find((btn) => btn.querySelector(".codicon-copy"))
382+
const deleteButton = screen.getByLabelText("Delete Task (Shift + Click to skip confirmation)")
381383

382-
expect(shareButton).toBeDisabled()
383-
// Export button should always be enabled regardless of buttonsDisabled
384+
// Share, export, and copy buttons should be enabled regardless of buttonsDisabled
385+
expect(shareButton).not.toBeDisabled()
384386
expect(exportButton).not.toBeDisabled()
387+
expect(copyButton).not.toBeDisabled()
388+
// Delete button should respect buttonsDisabled
389+
expect(deleteButton).toBeDisabled()
385390
})
386391

387-
it("export button is always enabled regardless of buttonsDisabled state", () => {
392+
it("share, export, and copy buttons are always enabled while delete button respects buttonsDisabled state", () => {
388393
// Test with buttonsDisabled = false
389394
const { rerender } = render(<TaskActions item={mockItem} buttonsDisabled={false} />)
395+
396+
let buttons = screen.getAllByRole("button")
397+
let shareButton = buttons.find((btn) => btn.querySelector(".codicon-link"))
390398
let exportButton = screen.getByLabelText("Export task history")
399+
let copyButton = buttons.find((btn) => btn.querySelector(".codicon-copy"))
400+
let deleteButton = screen.getByLabelText("Delete Task (Shift + Click to skip confirmation)")
401+
402+
expect(shareButton).not.toBeDisabled()
391403
expect(exportButton).not.toBeDisabled()
404+
expect(copyButton).not.toBeDisabled()
405+
expect(deleteButton).not.toBeDisabled()
392406

393407
// Test with buttonsDisabled = true
394408
rerender(<TaskActions item={mockItem} buttonsDisabled={true} />)
409+
410+
buttons = screen.getAllByRole("button")
411+
shareButton = buttons.find((btn) => btn.querySelector(".codicon-link"))
395412
exportButton = screen.getByLabelText("Export task history")
413+
copyButton = buttons.find((btn) => btn.querySelector(".codicon-copy"))
414+
deleteButton = screen.getByLabelText("Delete Task (Shift + Click to skip confirmation)")
415+
416+
// Share, export, and copy remain enabled
417+
expect(shareButton).not.toBeDisabled()
396418
expect(exportButton).not.toBeDisabled()
419+
expect(copyButton).not.toBeDisabled()
420+
// Delete button is disabled
421+
expect(deleteButton).toBeDisabled()
397422
})
398423
})
399424
})

0 commit comments

Comments
 (0)