Fixed account deletion test
parent
8da31cb293
commit
26e07bc2d8
|
@ -218,7 +218,11 @@ const ProfileView = () => {
|
|||
{/* Delete account Dialog */}
|
||||
<Dialog open={deleteAccountOpen} onOpenChange={setDeleteAccountOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button color="destructive" className="mt-1 border-2" StartIcon={Icon.FiTrash2}>
|
||||
<Button
|
||||
color="destructive"
|
||||
className="mt-1 border-2"
|
||||
StartIcon={Icon.FiTrash2}
|
||||
data-testid="delete-account">
|
||||
{t("delete_account")}
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
|
@ -227,6 +231,10 @@ const ProfileView = () => {
|
|||
description={t("confirm_delete_account_modal")}
|
||||
type="creation"
|
||||
actionText={t("delete_my_account")}
|
||||
actionProps={{
|
||||
// @ts-expect-error data attributes aren't typed
|
||||
"data-testid": "delete-account-confirm",
|
||||
}}
|
||||
Icon={Icon.FiAlertTriangle}
|
||||
actionOnClick={(e) => e && onConfirmButton(e)}>
|
||||
<>
|
||||
|
|
|
@ -65,6 +65,7 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
|||
loading = false,
|
||||
color = "primary",
|
||||
size = "base",
|
||||
type = "button",
|
||||
StartIcon,
|
||||
EndIcon,
|
||||
shallow,
|
||||
|
@ -82,6 +83,7 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
|
|||
{
|
||||
...passThroughProps,
|
||||
disabled,
|
||||
type: !isLink ? type : undefined,
|
||||
ref: forwardedRef,
|
||||
className: classNames(
|
||||
// base styles independent what type of button it is
|
||||
|
|
|
@ -73,10 +73,11 @@ type DialogContentProps = React.ComponentProps<typeof DialogPrimitive["Content"]
|
|||
useOwnActionButtons?: boolean;
|
||||
actionOnClick?: (e: Event | React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
actionOnClose?: () => void;
|
||||
actionProps?: React.ComponentProps<typeof Button>;
|
||||
};
|
||||
|
||||
export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
||||
({ children, Icon, ...props }, forwardedRef) => (
|
||||
({ children, Icon, actionProps, ...props }, forwardedRef) => (
|
||||
<DialogPrimitive.Portal>
|
||||
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-gray-500 bg-opacity-75 transition-opacity" />
|
||||
{/*zIndex one less than Toast */}
|
||||
|
@ -125,11 +126,15 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
|
|||
</Button>
|
||||
</DialogClose>
|
||||
{props.actionOnClick ? (
|
||||
<Button color="primary" disabled={props.actionDisabled} onClick={props.actionOnClick}>
|
||||
<Button
|
||||
color="primary"
|
||||
disabled={props.actionDisabled}
|
||||
onClick={props.actionOnClick}
|
||||
{...actionProps}>
|
||||
{props.actionText}
|
||||
</Button>
|
||||
) : (
|
||||
<Button color="primary" type="submit" disabled={props.actionDisabled}>
|
||||
<Button color="primary" type="submit" disabled={props.actionDisabled} {...actionProps}>
|
||||
{props.actionText}
|
||||
</Button>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue