π OpenHands: AI-Driven Development
fix(conversation-panel): pass testId to BrandButton in confirm modals (#18151)
Liang Xua68e81593e13
diff --git a/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx b/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsxindex bcd148c8ee..d5a938ed1b 100644--- a/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx+++ b/__tests__/components/features/conversation-panel/confirm-delete-modal.test.tsx@@ -37,9 +37,7 @@ describe("ConfirmDeleteModal", () => {/>,);- expect(- screen.getByText("CONVERSATION$DELETE_WARNING"),- ).toBeInTheDocument();+ expect(screen.getByText("CONVERSATION$DELETE_WARNING")).toBeInTheDocument();});it("places Cancel before Confirm in the footer so the dominant action is the last focusable button", () => {@@ -59,4 +57,15 @@ describe("ConfirmDeleteModal", () => {Node.DOCUMENT_POSITION_FOLLOWING,).toBeTruthy();});++ it("renders buttons with cancel-button and confirm-button test ids", () => {+ // Arrange: render the modal.+ renderWithProviders(+ <ConfirmDeleteModal onConfirm={vi.fn()} onCancel={vi.fn()} />,+ );++ // Assert: buttons expose the expected data-testid attributes.+ expect(screen.getByTestId("cancel-button")).toBeInTheDocument();+ expect(screen.getByTestId("confirm-button")).toBeInTheDocument();+ });});diff --git a/__tests__/components/features/conversation-panel/confirm-stop-modal.test.tsx b/__tests__/components/features/conversation-panel/confirm-stop-modal.test.tsxnew file mode 100644index 0000000000..75a70f0b61--- /dev/null+++ b/__tests__/components/features/conversation-panel/confirm-stop-modal.test.tsx@@ -0,0 +1,18 @@+import React from "react";+import { describe, it, expect, vi } from "vitest";+import { screen } from "@testing-library/react";+import { renderWithProviders } from "test-utils";+import { ConfirmStopModal } from "#/components/features/conversation-panel/confirm-stop-modal";++describe("ConfirmStopModal", () => {+ it("renders buttons with cancel-button and confirm-button test ids", () => {+ // Arrange: render the modal.+ renderWithProviders(+ <ConfirmStopModal onConfirm={vi.fn()} onCancel={vi.fn()} />,+ );++ // Assert: buttons expose the expected data-testid attributes.+ expect(screen.getByTestId("cancel-button")).toBeInTheDocument();+ expect(screen.getByTestId("confirm-button")).toBeInTheDocument();+ });+});diff --git a/src/components/features/conversation-panel/confirm-delete-modal.tsx b/src/components/features/conversation-panel/confirm-delete-modal.tsxindex 78377ff599..9ffec41072 100644--- a/src/components/features/conversation-panel/confirm-delete-modal.tsx+++ b/src/components/features/conversation-panel/confirm-delete-modal.tsx@@ -59,7 +59,7 @@ export function ConfirmDeleteModal({type="button"variant="secondary"onClick={onCancel}- data-testid="cancel-button"+ testId="cancel-button">{t(I18nKey.BUTTON$CANCEL)}</BrandButton>@@ -67,7 +67,7 @@ export function ConfirmDeleteModal({type="button"variant="primary"onClick={onConfirm}- data-testid="confirm-button"+ testId="confirm-button">{t(I18nKey.ACTION$CONFIRM_DELETE)}</BrandButton>diff --git a/src/components/features/conversation-panel/confirm-stop-modal.tsx b/src/components/features/conversation-panel/confirm-stop-modal.tsxindex 178fe9a7ae..50018b1d67 100644--- a/src/components/features/conversation-panel/confirm-stop-modal.tsx+++ b/src/components/features/conversation-panel/confirm-stop-modal.tsx@@ -38,7 +38,7 @@ export function ConfirmStopModal({type="button"variant="secondary"onClick={onCancel}- data-testid="cancel-button"+ testId="cancel-button">{t(I18nKey.BUTTON$CANCEL)}</BrandButton>@@ -46,7 +46,7 @@ export function ConfirmStopModal({type="button"variant="primary"onClick={onConfirm}- data-testid="confirm-button"+ testId="confirm-button">{t(I18nKey.ACTION$CONFIRM_CLOSE)}</BrandButton>