Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/shared/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ const MENU: MenuGroup[] = [
{
name: 'projects',
label: 'Projects',
// Projects are the house's own; they carry no subtitle, unlike Elsewhere's.
links: [
{ label: 'Tracy', to: '/tracy' },
{ label: 'Posterize', to: '/posterize' },
{ label: 'Metrics', to: '/metrics' },
{ label: 'Stats', to: '/stats', description: 'Traffic from the access logs' },
{ label: 'Wordchains', to: '/wordchains' },
{ label: 'iili', to: '/iili', description: 'URL shortener' },
{ label: 'iili', to: '/iili' },
{ label: 'Stats', to: '/stats' },
{ label: 'Metrics', to: '/metrics' },
],
},
{
Expand Down
40 changes: 25 additions & 15 deletions src/shared/components/__tests__/Navigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,34 @@ describe('Navigation', () => {
}
})

it('links stats as an internal Projects page beside metrics', () => {
it('lists the Projects in their order, as plain internal links without subtitles', () => {
renderWithRouter(<Navigation />)
const groupEl = testingScreen.getByText('Projects').closest('li')
if (!groupEl) throw new Error('Projects nav group not found')
const link = within(groupEl).getByRole('link', { name: /^Stats/ })
expect(link.getAttribute('href')).toBe('/stats')
expect(link.textContent).not.toContain('(external site)')
expect(within(link).getByText('Traffic from the access logs')).toBeDefined()
})

it('links iili as an internal Projects page', () => {
renderWithRouter(<Navigation />)
const groupEl = testingScreen.getByText('Projects').closest('li')
if (!groupEl) throw new Error('Projects nav group not found')
const link = within(groupEl).getByRole('link', { name: /^iili/ })
expect(link.getAttribute('href')).toBe('/iili')
expect(link.textContent).not.toContain('(external site)')
expect(within(link).getByText('URL shortener')).toBeDefined()
// The dropdown, not the group's own header anchor.
const dropdown = groupEl.querySelector('div')
if (!dropdown) throw new Error('Projects dropdown not found')
const links = within(dropdown).getAllByRole('link')
expect(links.map(link => link.textContent)).toEqual([
'Tracy',
'Posterize',
'Wordchains',
'iili',
'Stats',
'Metrics',
])
expect(links.map(link => link.getAttribute('href'))).toEqual([
'/tracy',
'/posterize',
'/wordchains',
'/iili',
'/stats',
'/metrics',
])
for (const link of links) {
expect(link.textContent).not.toContain('(external site)')
expect(link.querySelector('span')).toBeNull()
}
})

it('marks external links with a visible ↗ kept out of the accessible name', () => {
Expand Down
Loading