Skip to content

Commit

Permalink
fix: Delete modal button with lowercase text (#30060)
Browse files Browse the repository at this point in the history
(cherry picked from commit cd6b8b2)
  • Loading branch information
michael-s-molina authored and sadpandajoe committed Sep 6, 2024
1 parent 3becd6b commit e8d5ff1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test('calls the function on confirm', async () => {
const confirmInput = getByTestId('delete-modal-input');
fireEvent.change(confirmInput, { target: { value: 'DELETE' } });

const confirmButton = getByRole('button', { name: 'delete' });
const confirmButton = getByRole('button', { name: 'Delete' });
fireEvent.click(confirmButton);

await waitFor(() => expect(mockedProps.onConfirm).toHaveBeenCalledTimes(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ test('Calling "onConfirm" only after typing "delete" in the input', () => {
expect(props.onConfirm).toBeCalledTimes(0);

// 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);

// execute "onConfirm" if you have typed "delete"
userEvent.type(screen.getByTestId('delete-modal-input'), 'delete');
userEvent.click(screen.getByText('delete'));
userEvent.click(screen.getByText('Delete'));
expect(props.onConfirm).toBeCalledTimes(1);

// confirm input has been cleared
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/DeleteModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function DeleteModal({
disablePrimaryButton={disableChange}
onHide={hide}
onHandledPrimaryAction={confirm}
primaryButtonName={t('delete')}
primaryButtonName={t('Delete')}
primaryButtonType="danger"
show={open}
title={title}
Expand Down

0 comments on commit e8d5ff1

Please sign in to comment.