Skip to content

feat(other): add unit and e2e tests for info modal route (#657)#704

Open
mahula wants to merge 7 commits intomainfrom
test/info-modal-route
Open

feat(other): add unit and e2e tests for info modal route (#657)#704
mahula wants to merge 7 commits intomainfrom
test/info-modal-route

Conversation

@mahula
Copy link
Collaborator

@mahula mahula commented Feb 6, 2026

Test coverage for #657

Unit Tests (Vitest) — InfoRedirect.spec.tsx (5 tests)

  • U1: Navigates to /info when enabled and pathname is /
  • U2: Does not navigate when enabled=false
  • U3: Does not navigate when pathname ≠ /
  • U4: Only navigates once (useRef guard)
  • U5: Renders nothing (returns null)

E2E Tests (Cypress) — info-modal.cy.ts (4 tests)

  • E1: Visiting /info renders the modal
  • E2: NavBar ? icon navigates to /info
  • E3: ✕ button closes modal and navigates to /
  • E4: Content "Close" button closes modal and navigates to /

Design decisions


antontranelis and others added 6 commits January 12, 2026 16:45
- Move Modal from always-rendered to route-based rendering at /info
- Update Modal component to use MapOverlayPage instead of dialog element
- Update ModalContent to use useNavigate for closing (navigates to /)
- Add automatic redirect to /info when map.info_open is true on first load

This change makes the info modal accessible via URL and improves
the architecture by using the existing routing system.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add InfoRedirect component for one-time redirect to /info on page load
- Simplify Modal component to pure presentation (remove redirect logic)
- Change NavBar info button from showModal() to Link to /info route
- Remove unused window.my_modal_3 global type declaration
- Fix modal centering by removing conflicting position classes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove setTimeout firing after unmount in ModalContent (CR1)
- 4 Vitest unit tests for InfoRedirect guard logic
- 3 Cypress E2E tests for route, navigation, and close flow
- Restore window.location in afterEach to prevent cross-suite leaks
@mahula mahula self-assigned this Feb 6, 2026
@mahula mahula requested a review from antontranelis February 6, 2026 22:46
@mahula mahula added the feature label Feb 6, 2026
@mahula mahula enabled auto-merge (squash) February 6, 2026 22:48
@mahula
Copy link
Collaborator Author

mahula commented Feb 6, 2026

Already merge into #657

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants