diff --git a/src/core/ConfirmModal/ConfirmModal.test.tsx b/src/core/ConfirmModal/ConfirmModal.test.tsx index 0e4700cd..f43f7c13 100644 --- a/src/core/ConfirmModal/ConfirmModal.test.tsx +++ b/src/core/ConfirmModal/ConfirmModal.test.tsx @@ -43,8 +43,8 @@ describe('Component: ConfirmModal', () => { expect( screen.queryByText('Perform dangerous action') ).toBeInTheDocument(); - expect(screen.getAllByRole('button')[1]).toHaveTextContent('cancelNO'); - expect(screen.getAllByRole('button')[2]).toHaveTextContent('saveYES'); + expect(screen.getAllByRole('button')[1]).toHaveTextContent('closeNO'); + expect(screen.getAllByRole('button')[2]).toHaveTextContent('checkYES'); expect(document.body.lastChild).toMatchSnapshot(); }); }); @@ -98,7 +98,7 @@ describe('Component: ConfirmModal', () => { isOpen: true }); - fireEvent.click(screen.getByText('cancel')); + fireEvent.click(screen.getByText('close')); expect(onCloseSpy).toHaveBeenCalledTimes(1); expect(onSaveSpy).toHaveBeenCalledTimes(0); @@ -110,7 +110,7 @@ describe('Component: ConfirmModal', () => { isOpen: true }); - fireEvent.click(screen.getByText('save')); + fireEvent.click(screen.getByText('check')); expect(onCloseSpy).toHaveBeenCalledTimes(0); expect(onSaveSpy).toHaveBeenCalledTimes(1); diff --git a/src/core/ConfirmModal/ConfirmModal.tsx b/src/core/ConfirmModal/ConfirmModal.tsx index ccb6c45a..702bfcdf 100644 --- a/src/core/ConfirmModal/ConfirmModal.tsx +++ b/src/core/ConfirmModal/ConfirmModal.tsx @@ -1,6 +1,7 @@ -import React, { FormEventHandler } from 'react'; -import { OpenCloseModal } from '../OpenCloseModal/OpenCloseModal'; +import React from 'react'; import { t } from '../../utilities/translation/translation'; +import { Modal } from '../Modal/Modal'; +import { Button } from '../Button/Button'; type Props = { /** @@ -33,7 +34,7 @@ type Props = { /** * Function that gets called when the user clicks the save button */ - onSave: FormEventHandler; + onSave: () => void; /** * Text which is rendered inside the modal @@ -66,29 +67,44 @@ export function ConfirmModal({ className }: Props) { return ( - + + + + } > {modalText} - + ); } diff --git a/src/core/ConfirmModal/__snapshots__/ConfirmModal.test.tsx.snap b/src/core/ConfirmModal/__snapshots__/ConfirmModal.test.tsx.snap index 11444240..744f44a2 100644 --- a/src/core/ConfirmModal/__snapshots__/ConfirmModal.test.tsx.snap +++ b/src/core/ConfirmModal/__snapshots__/ConfirmModal.test.tsx.snap @@ -22,75 +22,73 @@ exports[`Component: ConfirmModal ui custom texts 1`] = ` - + check + + YES + + + + @@ -123,75 +121,73 @@ exports[`Component: ConfirmModal ui default texts 1`] = ` - + check + + Confirm + + + +