-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c58804f
commit f912458
Showing
4 changed files
with
81 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/wallets/src/components/WalletAddedSuccess/WalletAddedSuccessFooter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { Localize } from '@deriv-com/translations'; | ||
import { Button } from '@deriv-com/ui'; | ||
import { WalletButtonGroup } from '../Base'; | ||
|
||
type TWalletAddedSuccessFooterProps = { | ||
onPrimaryButtonClick: () => void; | ||
onSecondaryButtonClick: () => void; | ||
}; | ||
|
||
const WalletAddedSuccessFooter = ({ onPrimaryButtonClick, onSecondaryButtonClick }: TWalletAddedSuccessFooterProps) => { | ||
return ( | ||
<div className='wallets-add-more__success-footer'> | ||
<WalletButtonGroup isFlex isFullWidth> | ||
<Button onClick={onSecondaryButtonClick} variant='outlined'> | ||
<Localize i18n_default_text='Maybe later' /> | ||
</Button> | ||
<Button onClick={onPrimaryButtonClick}> | ||
<Localize i18n_default_text='Deposit' /> | ||
</Button> | ||
</WalletButtonGroup> | ||
</div> | ||
); | ||
}; | ||
|
||
export default WalletAddedSuccessFooter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ges/wallets/src/components/WalletAddedSuccess/__tests__/WalletAddedSuccessFooter.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import WalletAddedSuccessFooter from '../WalletAddedSuccessFooter'; | ||
|
||
describe('WalletAddedSuccessFooter', () => { | ||
const mockPrimaryClick = jest.fn(); | ||
const mockSecondaryClick = jest.fn(); | ||
|
||
beforeEach(() => { | ||
render( | ||
<WalletAddedSuccessFooter | ||
onPrimaryButtonClick={mockPrimaryClick} | ||
onSecondaryButtonClick={mockSecondaryClick} | ||
/> | ||
); | ||
}); | ||
|
||
it('renders the component with correct buttons', () => { | ||
expect(screen.getByText('Maybe later')).toBeInTheDocument(); | ||
expect(screen.getByText('Deposit')).toBeInTheDocument(); | ||
}); | ||
|
||
it('calls onSecondaryButtonClick when "Maybe later" button is clicked', () => { | ||
fireEvent.click(screen.getByText('Maybe later')); | ||
expect(mockSecondaryClick).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('calls onPrimaryButtonClick when "Deposit" button is clicked', () => { | ||
fireEvent.click(screen.getByText('Deposit')); | ||
expect(mockPrimaryClick).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |