Skip to content

FOLLOW-UP: Add test for sendNavigate → cross-pathname navigation sequence (from PR #72) #73

@adnaan

Description

@adnaan

Context

This follow-up task was identified during the review of PR #72.

Source PR: #72
PR Title: feat: lvt-preserve attributes, navigate SPA nav, DOMParser script fix
Suggested by: @claude[bot]

Task Description

The invariant that liveUrlOverride is correctly reset via window.location in handleNavigationResponse after a sendNavigate call is documented in comments but has no test coverage.

Add a test for this navigation sequence:

  1. Same-pathname sendNavigate (e.g. /route?s=A/route?s=B) — sets liveUrlOverride to /route?s=B
  2. Subsequent cross-pathname fetch navigation (e.g. → /other-page) — handleNavigationResponse reads window.location and calls connect()
  3. Assert: liveUrlOverride reflects the cross-path URL, not the stale same-pathname URL

This confirms the self-correction behavior is working so a future refactor doesn't silently break it.

Original Comment

Missing test for sendNavigate → cross-pathname navigation sequence.
sendNavigate sets this.liveUrlOverride to the same-pathname URL. A subsequent cross-pathname navigation in handleNavigationResponse resets it via window.location.pathname + window.location.search (relying on pushState already having run). This invariant is commented but untested — a test for the sequence /route?s=A → same-pathname sendNavigate → click cross-path → confirm liveUrlOverride is the cross-path URL would be cheap insurance.


This issue was automatically created by prmonitor from PR review comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upFollow-up task from PR reviewfrom-reviewIssue originated from PR review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions