diff --git a/src/containers/Form/FormLayout.tsx b/src/containers/Form/FormLayout.tsx index 943492c2b..21f671d4e 100644 --- a/src/containers/Form/FormLayout.tsx +++ b/src/containers/Form/FormLayout.tsx @@ -667,7 +667,10 @@ export const FormLayout = ({ handleOk={() => { saveHandler(formik.values); }} - handleCancel={() => setShowConfirmationDialog(false)} + handleCancel={() => { + onSaveClick(false); + setShowConfirmationDialog(false); + }} colorOk="warning" alignButtons="center" contentAlign="center" diff --git a/src/containers/SettingList/Providers/Providers.test.tsx b/src/containers/SettingList/Providers/Providers.test.tsx index c82cabeaa..89a05d030 100644 --- a/src/containers/SettingList/Providers/Providers.test.tsx +++ b/src/containers/SettingList/Providers/Providers.test.tsx @@ -186,7 +186,15 @@ describe('update credentials', () => { fireEvent.change(inputs[0], { target: { value: 'token2' } }); fireEvent.change(inputs[1], { target: { value: 'product_id2' } }); - fireEvent.click(screen.getByText('Save')); + fireEvent.click(screen.getByTestId('submitActionButton')); + + await waitFor(() => { + expect(screen.getByTestId('dialogBox')).toBeInTheDocument(); + }); + + // testing if it closes the dialog box + fireEvent.click(screen.getByTestId('cancel-button')); + fireEvent.click(screen.getByTestId('submitActionButton')); await waitFor(() => { expect(screen.getByTestId('dialogBox')).toBeInTheDocument();