From 740e34210b67607ee86269e1ecfa824d0272ed51 Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Wed, 10 Jun 2026 16:02:43 -0400 Subject: [PATCH] test(06): add failing BottomTabBar hidden-on-desktop test (FIX 4) --- apps/pwa/src/components/BottomTabBar.test.tsx | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 apps/pwa/src/components/BottomTabBar.test.tsx 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