From 77a66e1376d7c9d5a036f2c48a9cf7e30d7ee919 Mon Sep 17 00:00:00 2001 From: NogaNHS <127490765+NogaNHS@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:57:38 +0100 Subject: [PATCH] PRMDR-759 Radio button improvement (#353) --- .../DeleteDocumentsStage.test.tsx | 18 +++--- .../DeleteDocumentsStage.tsx | 58 ++++++++----------- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.test.tsx b/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.test.tsx index f9f1ad131..66d5f8599 100644 --- a/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.test.tsx +++ b/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.test.tsx @@ -75,10 +75,11 @@ describe('DeleteDocumentsStage', () => { expect(noButton).toBeInTheDocument(); expect(noButton).not.toBeChecked(); expect(screen.getByRole('button', { name: 'Continue' })).toBeInTheDocument(); - expect(screen.queryByTestId('delete-error-box')).not.toBeInTheDocument(); - expect(screen.queryByTestId('delete-button-uncheck-message')).toHaveClass( - 'nhsuk-error-message-hidden', - ); + expect( + screen.queryByText( + 'Select whether you want to permanently delete these patient files', + ), + ).not.toBeInTheDocument(); }, ); @@ -221,10 +222,11 @@ describe('DeleteDocumentsStage', () => { userEvent.click(screen.getByRole('button', { name: 'Continue' })); }); expect(await screen.findByText('You must select an option')).toBeInTheDocument(); - expect(await screen.findByTestId('delete-button-uncheck-message')).toBeInTheDocument(); - expect(screen.queryByTestId('delete-button-uncheck-message')).not.toHaveClass( - 'nhsuk-error-message-hidden', - ); + expect( + screen.getByText( + 'Select whether you want to permanently delete these patient files', + ), + ).toBeInTheDocument(); }); }); }); diff --git a/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.tsx b/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.tsx index 88123a449..f2389ee19 100644 --- a/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.tsx +++ b/app/src/components/blocks/deleteDocumentsStage/DeleteDocumentsStage.tsx @@ -57,7 +57,8 @@ function DeleteDocumentsStage({ const nhsNumber: string = patientDetails?.nhsNumber ?? ''; const formattedNhsNumber = formatNhsNumber(nhsNumber); const [showNoOptionSelectedMessage, setShowNoOptionSelectedMessage] = useState(false); - + const noOptionSelectedError = + 'Select whether you want to permanently delete these patient files'; const dob: string = patientDetails?.birthDate ? getFormattedDate(new Date(patientDetails.birthDate)) : ''; @@ -148,42 +149,29 @@ function DeleteDocumentsStage({ Are you sure you want to permanently delete files for:
{patientInfo}
-
- + Yes + + - Select whether you want to permanently delete these patient files - Error: - - - - Yes - - - No - - -
+ No + + {deletionStage === SUBMISSION_STATE.PENDING ? (