import Envelop from '@components/atoms/icons/envelop';
import Home from '@components/atoms/icons/home';
import { render, screen } from '@tests/utils';
import Nav, { type NavItem } from './nav';

const navItems: NavItem[] = [
  { id: 'homeLink', href: '/', label: 'Home', logo: <Home /> },
  { id: 'contactLink', href: '/contact', label: 'Contact', logo: <Envelop /> },
];

describe('Nav', () => {
  it('renders a main navigation', () => {
    render(<Nav kind="main" items={navItems} />);
    expect(screen.getByRole('navigation')).toHaveClass('nav--main');
  });

  it('renders a footer navigation', () => {
    render(<Nav kind="footer" items={navItems} />);
    expect(screen.getByRole('navigation')).toHaveClass('nav--footer');
  });

  it('renders navigation links', () => {
    render(<Nav kind="main" items={navItems} />);
    expect(
      screen.getByRole('link', { name: navItems[0].label })
    ).toHaveAttribute('href', navItems[0].href);
  });
});
>
<input type='hidden' name='id' value='f7b08ee862e62b9f8764303f1fef733f210a7138'/><select name='h' onchange='this.form.submit();'>
<option value='main' selected='selected'>main</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>The frontend of my personal website.</td><td class='sub right'>Armand Philippot</td></tr></table>
<table class='tabs'><tr><td>
<a href='/www.armandphilippot.com/about/'>about</a><a href='/www.armandphilippot.com/'>summary</a><a href='/www.armandphilippot.com/refs/?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>refs</a><a href='/www.armandphilippot.com/log/src/components/PostHeader/PostHeader.module.scss'>log</a><a class='active' href='/www.armandphilippot.com/tree/src/components/PostHeader/PostHeader.module.scss?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>tree</a><a href='/www.armandphilippot.com/commit/src/components/PostHeader/PostHeader.module.scss?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>commit</a><a href='/www.armandphilippot.com/diff/src/components/PostHeader/PostHeader.module.scss?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>diff</a><a href='/www.armandphilippot.com/stats/src/components/PostHeader/PostHeader.module.scss'>stats</a></td><td class='form'><form class='right' method='get' action='/www.armandphilippot.com/log/src/components/PostHeader/PostHeader.module.scss'>
<input type='hidden' name='id' value='f7b08ee862e62b9f8764303f1fef733f210a7138'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/www.armandphilippot.com/tree/?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>root</a>/<a href='/www.armandphilippot.com/tree/src?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>src</a>/<a href='/www.armandphilippot.com/tree/src/components?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>components</a>/<a href='/www.armandphilippot.com/tree/src/components/PostHeader?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>PostHeader</a>/<a href='/www.armandphilippot.com/tree/src/components/PostHeader/PostHeader.module.scss?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>PostHeader.module.scss</a></div><div class='content'>blob: f013651baaa4cc44eae3bc155e081edd4ee73cfb (<a href='/www.armandphilippot.com/plain/src/components/PostHeader/PostHeader.module.scss?id=f7b08ee862e62b9f8764303f1fef733f210a7138'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
</pre></td>
<td class='lines'><pre><code>