Public Access
feat(header): add community link to nav
Add an icon-only nav link to "/" so logged-in users can get back to the community stats. Make room for it: less nav link padding below sm, points chip no longer shrinks from lg, and the view-as badge hangs below the header at every width.
This commit is contained in:
1 parent
e7b08cfb47
commit
1dab069a4d
4 files changed
+35
-9
No files matched your search
@@ -16,11 +16,11 @@ afterEach(() => {
|
||||
useTranslation().i18n.language = 'de';
|
||||
});
|
||||
|
||||
const loggedInAs = (me, routes = {}) => {
|
||||
const loggedInAs = (me, routes = {}, options = {}) => {
|
||||
localStorage.setItem('tbp_session', '1');
|
||||
fetchRoutes({'GET /api/users/me': json(200, me), 'GET /api/library/steam-profile': json(200, {}),
|
||||
'GET /api/inbox': json(200, {results: [], unread: 0}), ...routes});
|
||||
renderWithProviders(<AppHeader isAuthenticated onLogout={() => {}}/>);
|
||||
renderWithProviders(<AppHeader isAuthenticated onLogout={() => {}}/>, options);
|
||||
};
|
||||
|
||||
const openMenu = () => fireEvent.keyDown(screen.getByRole('button', {name: 'NAV.MENU'}), {key: 'Enter'});
|
||||
@@ -44,6 +44,29 @@ describe('AppHeader', () => {
|
||||
screen.getByText('ToBePlayed').style.display = 'none';
|
||||
|
||||
expect(screen.getByRole('link', {name: 'ToBePlayed'})).toBeTruthy();
|
||||
expect(screen.queryByTitle('NAV.COMMUNITY')).toBeNull();
|
||||
});
|
||||
|
||||
it('links to the community stats when logged in', () => {
|
||||
loggedInAs({role: 'USER', activeRole: 'USER'});
|
||||
|
||||
const link = screen.getByTitle('NAV.COMMUNITY');
|
||||
|
||||
expect(link.getAttribute('href')).toBe('/');
|
||||
expect(link.getAttribute('aria-current')).toBe('page');
|
||||
});
|
||||
|
||||
it('shows the community link as an icon without a text label', () => {
|
||||
loggedInAs({role: 'USER', activeRole: 'USER'});
|
||||
|
||||
expect(screen.getByTitle('NAV.COMMUNITY').textContent).toBe('');
|
||||
});
|
||||
|
||||
it('marks community active only on the landing page', () => {
|
||||
loggedInAs({role: 'USER', activeRole: 'USER'}, {}, {entries: ['/dashboard']});
|
||||
|
||||
expect(screen.getByTitle('NAV.COMMUNITY').getAttribute('aria-current')).toBeNull();
|
||||
expect(screen.getByTitle('NAV.DASHBOARD').getAttribute('aria-current')).toBe('page');
|
||||
});
|
||||
|
||||
it('shows how many inbox notes are unread', async () => {
|
||||
|
||||
Reference in new issue
Block a user