avh4 / avh4/elm-program-test

Add support for navigation (back, forward)

Open
#40 1 comment 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted semver: minor
Dominant language
Elm
Stars
95
Forks
28
PR merge metrics
No merged PRs in 30d

Description

The browser history is already maintained in the ProgramTest model (inspectable with `expectBrowserUrl` and `expectBrowserHistory`). This issue would add `back` and `forward` to `SimulatedEffect.Navigation` to parallel the functions in https://package.elm-lang.org/packages/elm/browser/latest/Browser-Navigation . Simulating those events should have the effect of calling `routeChangeHelper` with the new URL if the action can be performed, or failing the test if not.

Implementing `forward` will require adding the forward "history" to the ProgramTest model.

If you are looking to contribute, feel free to make a PR that only implements one of these functions. This is marked "good first issue", but you'd need to have a good understanding of using elm-program-test and of https://elm-program-test.netlify.com/cmds.html or else this probably won't be easy.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the ProgramTest model, its existing browser-history behavior through expectBrowserUrl and expectBrowserHistory, and SimulatedEffect.Navigation. Trace routeChangeHelper and the existing command tests or entry points, then implement either back or forward. Done means a performable action calls routeChangeHelper with the new URL, while an unavailable action fails the test; forward also requires the model's forward history.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.