Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Delete modal button with lowercase text #30060

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -80,7 +80,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
Loading