Skip to content

Commit 1922b8a

Browse files
committed
test: update HistoryView delete task test to handle confirmation dialog
1 parent fc660a5 commit 1922b8a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

webview-ui/src/components/history/__tests__/HistoryView.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,22 @@ describe("HistoryView", () => {
135135
})
136136
})
137137

138-
it("handles task deletion", () => {
138+
it("handles task deletion", async () => {
139139
const onDone = jest.fn()
140140
render(<HistoryView onDone={onDone} />)
141141

142142
// Find and hover over first task
143143
const taskContainer = screen.getByTestId("virtuoso-item-1")
144144
fireEvent.mouseEnter(taskContainer)
145145

146+
// Click delete button to open confirmation dialog
146147
const deleteButton = within(taskContainer).getByTitle("Delete Task")
147148
fireEvent.click(deleteButton)
148149

150+
// Find and click the confirm delete button in the dialog
151+
const confirmDeleteButton = screen.getByRole("button", { name: /delete/i })
152+
fireEvent.click(confirmDeleteButton)
153+
149154
// Verify vscode message was sent
150155
expect(vscode.postMessage).toHaveBeenCalledWith({
151156
type: "deleteTaskWithId",

0 commit comments

Comments
 (0)