Skip to content

Commit

Permalink
fix: change password success modal (deriv-com#17608)
Browse files Browse the repository at this point in the history
  • Loading branch information
lubega-deriv authored Nov 26, 2024
1 parent baf4303 commit b4f847c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,25 @@ const WalletSuccessResetMT5Password: FC<WalletSuccessResetMT5PasswordProps> = ({

const renderButtons = (
<Button isFullWidth={!isDesktop} onClick={onClick} size='lg' textSize='sm'>
{isInvestorPassword ? localize('Ok') : localize('Done')}
{localize('OK')}
</Button>
);

return (
<ModalStepWrapper
renderFooter={isDesktop ? undefined : () => renderButtons}
shouldHideFooter={isDesktop}
title={
isInvestorPassword
? localize('Reset {{title}} password', { title })
: localize('Manage {{title}} password', { title })
}
title={isInvestorPassword ? localize('Reset {{title}} password', { title }) : localize('Success')}
>
<div className='wallets-reset-mt5-password'>
<ActionScreen
actionButtons={isDesktop ? renderButtons : undefined}
description={
isInvestorPassword
? localize('Your investor password has been changed.')
: localize(
'You have a new {{title}} password to log in to your {{title}} accounts on the web and mobile apps.',
{ title }
)
: localize('You can log in to all your {{title}} accounts with your new password.', {
title,
})
}
descriptionSize='sm'
icon={
Expand All @@ -53,7 +48,7 @@ const WalletSuccessResetMT5Password: FC<WalletSuccessResetMT5PasswordProps> = ({
<DerivLightMt5SuccessPasswordResetIcon height={100} width={100} />
)
}
title={isInvestorPassword ? localize('Password saved') : localize('Success')}
title={isInvestorPassword ? localize('Password saved') : undefined}
/>
</div>
</ModalStepWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,20 @@ describe('<WalletsErrorMT5InvestorPassword />', () => {
expect(screen.getByText('Reset mocked password'));
expect(screen.getByText('Password saved'));
expect(screen.getByText('Your investor password has been changed.'));
expect(screen.getByRole('button', { name: 'Ok' }));
expect(screen.getByRole('button', { name: 'OK' }));
});

it('should render content if isInvestorPassword is false', () => {
render(<WalletSuccessResetMT5Password {...props} />, { wrapper });
expect(screen.getByText('Manage mocked password'));
expect(screen.getByText('Success'));
expect(
screen.getByText(
'You have a new mocked password to log in to your mocked accounts on the web and mobile apps.'
)
);
expect(screen.getByRole('button', { name: 'Done' }));
expect(screen.getByText('You can log in to all your mocked accounts with your new password.'));
expect(screen.getByRole('button', { name: 'OK' }));
});

it('should execute function onClick when button is clicked', async () => {
render(<WalletSuccessResetMT5Password {...props} />, { wrapper });
expect(screen.getByRole('button', { name: 'Done' }));
await userEvent.click(screen.getByRole('button', { name: 'Done' }));
expect(screen.getByRole('button', { name: 'OK' }));
await userEvent.click(screen.getByRole('button', { name: 'OK' }));
expect(props.onClick).toBeCalled();
});

Expand Down

0 comments on commit b4f847c

Please sign in to comment.