Add shared navigation to every page
The pages were only reachable by typing URLs, and the digest had no navigation at all. A single _nav.html partial now appears on all four, marking the current page, so Triage / Digest / Tune / Config are one click apart. Parameterised test asserts every page links to the others and marks itself active, so a page added later cannot ship stranded.
This commit is contained in:
1 parent
5f4bc8d890
commit
327d6a69ae
7 files changed
+69
-15
No files matched your search
@@ -232,3 +232,14 @@ def test_labelling_is_disabled_when_no_secret_is_configured(tmp_path, monkeypatc
|
||||
from news import web
|
||||
web._VECTORS = None
|
||||
assert "labelling is disabled" in TestClient(web.app).get("/").text
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path,active", [
|
||||
("/", "Triage"), ("/tune", "Tune"), ("/config", "Config"), ("/digest", "Digest")])
|
||||
def test_every_page_carries_the_nav(client, path, active):
|
||||
"""Navigation must not require knowing the URLs."""
|
||||
c, _ = client
|
||||
html = c.get(path).text
|
||||
for target in ("/tune", "/config", "/digest"):
|
||||
assert f'href="{target}"' in html, f"{path} is missing a link to {target}"
|
||||
assert f'class="here">{active}<' in html, f"{path} does not mark itself active"
|
||||
Reference in new issue
Block a user