Skip to content

test(mail): add regression coverage for mobile navigation #1071

Open
real-venus wants to merge 1 commit into
Stellar-Mail:mainfrom
real-venus:tests/mobile-navigation
Open

test(mail): add regression coverage for mobile navigation #1071
real-venus wants to merge 1 commit into
Stellar-Mail:mainfrom
real-venus:tests/mobile-navigation

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

Adds focused regression coverage for the existing Mobile Navigation surface (issue #979) — bottom navigation, sidebar collapse boundary, and the responsive switch. Scoped to existing app paths; no new tool or feature. Two small pure helpers were extracted so the behavior is testable without a DOM, and the bottom bar gained minor accessibility attributes.

Closes #979

Changes

  • Mobile breakpoint helper — extracted pure isMobileViewport(width) + MOBILE_BREAKPOINT in src/hooks/use-mobile.tsx; the hook now delegates to it (behavior unchanged). Boundary aligns with Tailwind's md (768px).
  • Bottom-nav contract — new src/components/mail/bottom-navigation-items.ts with BOTTOM_NAV_ITEMS descriptors and a pure isBottomNavItemActive() so the active-tab logic is a stable, testable contract.
  • BottomNavigation — consumes the descriptors (rendering identical); adds aria-current="page" on the active tab and an accessible aria-label="Bottom navigation" on the nav.
  • Unit tests — breakpoint — success (phone/desktop widths), edge (exact 768px boundary), failure (degenerate widths).
  • Unit tests — bottom nav — success (folder tabs highlight), edge (wrong folder), failure (action-only tabs never active); plus order/folder-mapping assertions.
  • Playwright spec — mobile-viewport flow: bottom bar shown / desktop sidebar hidden, tapping a folder tab switches the mailbox, action-only tabs stay inactive.

Add focused tests for the existing mobile/small-screen navigation surface
(issue Stellar-Mail#979), keeping all work inside current app paths.

- Extract two small pure helpers so behavior is testable without a DOM:
  - isMobileViewport / MOBILE_BREAKPOINT in hooks/use-mobile.tsx
  - BOTTOM_NAV_ITEMS / isBottomNavItemActive for the bottom bar
- BottomNavigation consumes the descriptors (rendering unchanged) and now
  sets aria-current="page" on the active tab plus an accessible nav label.
- Unit tests (vitest): breakpoint predicate (below/above + 768px boundary +
  degenerate widths) and bottom-nav active-state contract (success + edge +
  action-only tabs never active).
- Playwright spec: mobile-viewport flow — bottom bar shown / sidebar hidden,
  tapping a folder tab switches the mailbox, action tabs stay inactive.

Fixtures stay fake and deterministic; tests assert user-visible outcomes and
stable helper contracts. Unit suite passes (448). The Playwright spec is not
run here: this sandbox lacks the pinned Playwright browser binary
(chromium_headless_shell-1148); it runs once `playwright install` is available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Existing app][Mobile Navigation] Add regression coverage for current behavior

1 participant