fix: Delete modal button with lowercase text (#30060)

This commit is contained in:
Michael S. Molina 2024-08-30 13:33:22 -03:00 committed by GitHub
parent 1f2f66bcb0
commit cd6b8b2f6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ test('calls the function on confirm', async () => {
const confirmInput = getByTestId('delete-modal-input'); const confirmInput = getByTestId('delete-modal-input');
fireEvent.change(confirmInput, { target: { value: 'DELETE' } }); fireEvent.change(confirmInput, { target: { value: 'DELETE' } });
const confirmButton = getByRole('button', { name: 'delete' }); const confirmButton = getByRole('button', { name: 'Delete' });
fireEvent.click(confirmButton); fireEvent.click(confirmButton);
await waitFor(() => expect(mockedProps.onConfirm).toHaveBeenCalledTimes(1)); await waitFor(() => expect(mockedProps.onConfirm).toHaveBeenCalledTimes(1));

View File

@ -77,12 +77,12 @@ test('Calling "onConfirm" only after typing "delete" in the input', () => {
expect(props.onConfirm).toBeCalledTimes(0); expect(props.onConfirm).toBeCalledTimes(0);
// do not execute "onConfirm" if you have not typed "delete" // do not execute "onConfirm" if you have not typed "delete"
userEvent.click(screen.getByText('delete')); userEvent.click(screen.getByText('Delete'));
expect(props.onConfirm).toBeCalledTimes(0); expect(props.onConfirm).toBeCalledTimes(0);
// execute "onConfirm" if you have typed "delete" // execute "onConfirm" if you have typed "delete"
userEvent.type(screen.getByTestId('delete-modal-input'), 'delete'); userEvent.type(screen.getByTestId('delete-modal-input'), 'delete');
userEvent.click(screen.getByText('delete')); userEvent.click(screen.getByText('Delete'));
expect(props.onConfirm).toBeCalledTimes(1); expect(props.onConfirm).toBeCalledTimes(1);
// confirm input has been cleared // confirm input has been cleared

View File

@ -80,7 +80,7 @@ export default function DeleteModal({
disablePrimaryButton={disableChange} disablePrimaryButton={disableChange}
onHide={hide} onHide={hide}
onHandledPrimaryAction={confirm} onHandledPrimaryAction={confirm}
primaryButtonName={t('delete')} primaryButtonName={t('Delete')}
primaryButtonType="danger" primaryButtonType="danger"
show={open} show={open}
title={title} title={title}