From f33008efbfdec5a75badb7f4ba1205b32e480003 Mon Sep 17 00:00:00 2001 From: Carlo Q Date: Fri, 19 Jan 2024 15:31:57 -0800 Subject: [PATCH 1/2] ignore case when confirming deletes --- .../ui/src/components/common/DeleteWidget/DeleteWidgetModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.tsx index 14907f68a1fe..d7f3e97ff6e3 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.tsx @@ -124,7 +124,7 @@ const DeleteWidgetModal = ({ const isDeleteTextPresent = useMemo(() => { return ( - deleteConfirmationText === DELETE_CONFIRMATION_TEXT && + deleteConfirmationText.toLowerCase() === DELETE_CONFIRMATION_TEXT.toLowerCase() && (deletionType === DeleteType.SOFT_DELETE || deletionType === DeleteType.HARD_DELETE) ); From f02c98aee24ac23488722e93be2f41be65051323 Mon Sep 17 00:00:00 2001 From: Carlo Q Date: Fri, 19 Jan 2024 15:45:57 -0800 Subject: [PATCH 2/2] Test confirmation of deletes works when case differs Added test case for 'delete' as the confirmation text. --- .../DeleteWidget/DeleteWidgetModal.test.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.test.tsx index ea3402f9c2e8..5a4b09c35cfb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetModal.test.tsx @@ -80,6 +80,24 @@ describe('Test DeleteWidgetV1 Component', () => { }); }); + it('Delete click should work properly regardless of capitalization', async () => { + await act(async () => { + render(); + + const inputBox = await screen.findByTestId('confirmation-text-input'); + const confirmButton = await screen.findByTestId('confirm-button'); + const hardDelete = await screen.findByTestId('hard-delete'); + + userEvent.click(hardDelete); + + userEvent.type(inputBox, 'delete'); + + expect(confirmButton).not.toBeDisabled(); + + userEvent.click(confirmButton); + }); + }); + it('Discard click should work properly', async () => { await act(async () => { render();