feat: add account navigation and footer
Move Inbox into a top-right account area, add a profile page for the authenticated user, and introduce a configurable sitemap and useful-links footer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0d8a25e73f
commit
83d14d23a2
9 changed files with 388 additions and 36 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { BrowserRouter, MemoryRouter } from 'react-router-dom'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
|
@ -220,6 +220,37 @@ describe('Go Guess frontend', () => {
|
|||
expect(screen.queryByRole('link', { name: 'Senior Go Engineer' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('moves account links to the top and renders the logged-in user profile and footer', async () => {
|
||||
authenticate()
|
||||
renderApp('/profile')
|
||||
|
||||
expect(await screen.findByRole('heading', { level: 1, name: 'Admin' })).toBeInTheDocument()
|
||||
expect(screen.getByText('admin@example.com')).toBeInTheDocument()
|
||||
|
||||
const accountNavigation = screen.getByRole('navigation', { name: 'Account navigation' })
|
||||
expect(within(accountNavigation).getByRole('link', { name: 'Inbox' })).toHaveAttribute(
|
||||
'href',
|
||||
'/inbox',
|
||||
)
|
||||
expect(within(accountNavigation).getByRole('link', { name: 'Admin' })).toHaveAttribute(
|
||||
'href',
|
||||
'/profile',
|
||||
)
|
||||
|
||||
const primaryNavigation = screen.getByRole('navigation', { name: 'Primary navigation' })
|
||||
expect(within(primaryNavigation).queryByRole('link', { name: 'Inbox' })).not.toBeInTheDocument()
|
||||
|
||||
const footerNavigation = screen.getByRole('navigation', { name: 'Footer navigation' })
|
||||
expect(within(footerNavigation).getByRole('link', { name: 'Jobs' })).toHaveAttribute(
|
||||
'href',
|
||||
'/jobs',
|
||||
)
|
||||
expect(within(footerNavigation).getByRole('link', { name: 'Your profile' })).toHaveAttribute(
|
||||
'href',
|
||||
'/profile',
|
||||
)
|
||||
})
|
||||
|
||||
it('adds multiple choice options with the accessible plus button', async () => {
|
||||
authenticate()
|
||||
const user = userEvent.setup()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue