Skip to content

Commit

Permalink
Mai/Fix-413-added in Link to logo (#446)
Browse files Browse the repository at this point in the history
fixes #413 
1) added Link to LogoNav
2) created a unit test to ensure link existed.



https://github.com/user-attachments/assets/1021d492-2dbd-44af-91c9-4e62b9043513

<img width="1213" alt="Screenshot 2024-07-20 at 12 38 38 PM"
src="https://github.com/user-attachments/assets/39fd0a44-fd63-4ce1-8cfb-ead3d94b2aa2">
  • Loading branch information
vmaineng authored Jul 31, 2024
1 parent 5bb182c commit 952563d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
14 changes: 14 additions & 0 deletions components/LogoNav/LogoNav.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import LogoNav from './LogoNav';

describe('LogoNav Component', () => {
it('renders the logo and links to the /league/all page', () => {
render(<LogoNav />);

const logoImage = screen.getByTestId('logo-nav');
expect(logoImage).toBeInTheDocument();

const linkLogoNav = screen.getByTestId('link-logo-nav');
expect(linkLogoNav).toHaveAttribute('href', '/league/all');
});
});
19 changes: 10 additions & 9 deletions components/LogoNav/LogoNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { JSX } from 'react';
import Image from 'next/image';
import Link from 'next/link';
import logo from '/public/assets/logo-colored-nav.svg';

/**
Expand All @@ -11,15 +12,15 @@ import logo from '/public/assets/logo-colored-nav.svg';
*/
export const LogoNav = (): JSX.Element => {
return (
<Image
src={logo}
alt="Gridiron Survivor logo"
width={1}
height={1}
priority
className="w-20"
data-testid="logo-nav"
/>
<Link data-testid="link-logo-nav" href="/league/all">
<Image
alt="Gridiron Survivor logo"
data-testid="logo-nav"
height={36}
src={logo}
width={80}
/>
</Link>
);
};

Expand Down

0 comments on commit 952563d

Please sign in to comment.