Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 3d4c2bf

Browse files
refactor: replace btn with a tag
1 parent 20e8969 commit 3d4c2bf

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

src/components/Footer/__tests__/Footer.test.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,15 @@ describe('HeroHeader', () => {
2626
);
2727
expect(footer_description).toBeInTheDocument();
2828
});
29-
it('should render community link when community button is clicked', async () => {
30-
window.open = jest.fn();
31-
32-
const communityButton = screen.getByRole('button', { name: 'Join our community' });
33-
expect(communityButton).toBeInTheDocument();
34-
await userEvent.click(communityButton);
35-
36-
expect(window.open).toHaveBeenCalledWith('https://deriv.vanillacommunity.com/');
37-
});
38-
it('should render telegram link when telegram button is clicked', async () => {
39-
window.open = jest.fn();
40-
41-
const telegramButton = screen.getByRole('button', { name: 'Telegram' });
42-
expect(telegramButton).toBeInTheDocument();
43-
await userEvent.click(telegramButton);
44-
45-
expect(window.open).toHaveBeenCalledWith('https://t.me/+g6FV5tFY1u9lZGE1');
29+
it('should render community link properly', () => {
30+
const community_link = screen.getByRole('link', { name: 'Join our community' });
31+
expect(community_link).toBeInTheDocument();
32+
expect(community_link).toHaveAttribute('href', 'https://deriv.vanillacommunity.com/');
33+
});
34+
it('should render telegram link properly', () => {
35+
const telegram_link = screen.getByRole('link', { name: 'Telegram' });
36+
expect(telegram_link).toBeInTheDocument();
37+
expect(telegram_link).toHaveAttribute('href', 'https://t.me/+g6FV5tFY1u9lZGE1');
4638
});
4739
it('should render footer body texts properly', () => {
4840
const help_text = screen.getByText(/^we're here to help$/i);

src/components/Footer/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@ const Footer = () => {
1313
Discuss ideas and share solutions with developers worldwide.
1414
</p>
1515
<div className={styles.Communities}>
16-
<button
16+
<a
17+
href='https://deriv.vanillacommunity.com/'
18+
target='_blank'
19+
rel='noreferrer'
1720
className={styles.communityButton}
18-
onClick={() => window.open('https://deriv.vanillacommunity.com/')}
1921
>
20-
Join our community
21-
</button>
22-
<button
22+
<span>Join our community</span>
23+
</a>
24+
<a
25+
href='https://t.me/+g6FV5tFY1u9lZGE1'
26+
target='_blank'
27+
rel='noreferrer'
2328
className={styles.communityButton}
24-
onClick={() => window.open('https://t.me/+g6FV5tFY1u9lZGE1')}
2529
>
2630
<div className={styles.Telegram}>
2731
<img src='/img/telegram.svg' className={styles.TelegramIcon} />
2832
<p>Telegram</p>
2933
</div>
30-
</button>
34+
</a>
3135
</div>
3236
</section>
3337
<section className={styles.FooterBody}>

0 commit comments

Comments
 (0)