diff --git a/apps/pwa/src/components/BottomTabBar.test.tsx b/apps/pwa/src/components/BottomTabBar.test.tsx new file mode 100644 index 0000000..eb28a15 --- /dev/null +++ b/apps/pwa/src/components/BottomTabBar.test.tsx @@ -0,0 +1,82 @@ +/** + * BottomTabBar visibility test — verifies the bar is hidden on desktop (≥768px). + * + * FIX 4: BottomTabBar must be phone-only (≤767px). On desktop it was + * position:fixed bottom:0 with no hide rule, overlaying the Settings/avatar + * in AppNav's sidebar. + * + * The test environment's matchMedia polyfill (test-setup.ts) returns + * matches:false for all queries, simulating a desktop viewport. + * The BottomTabBar should NOT render on desktop. + */ + +import React from 'react' +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { render, screen } from '@testing-library/react' +import { MemoryRouter } from 'react-router' +import { BottomTabBar } from './BottomTabBar.js' + +describe('BottomTabBar visibility (FIX 4)', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('does NOT render on desktop (matchMedia max-width:767px returns false)', () => { + // test-setup.ts matchMedia polyfill returns matches:false for all queries + // → (max-width: 767px) matches false → desktop → BottomTabBar should not render + render( + + + , + ) + + // The nav element should not be in the document on desktop + const nav = screen.queryByRole('navigation', { name: /Main navigation/i }) + // BottomTabBar renders a