diff --git a/meshterm/ui/about.py b/meshterm/ui/about.py index 76690a2..22d42ef 100644 --- a/meshterm/ui/about.py +++ b/meshterm/ui/about.py @@ -13,11 +13,10 @@ for what each construct becomes). Filling a page in means editing its ``.md`` fi no screen, menu row, or CLI face has to follow — and everything markdown offers is available while doing it: sections, sub-headings, lists, quotes, links, tables. -Every page is **scaffolding** today. The headings are the real shape — that is the part -worth settling first — and each carries one lowercase muted ``placeholder — …`` line -where its prose will go, in the same empty-state voice the rest of the app uses, so an -unwritten page reads as deliberately unwritten rather than as a screen that failed to -load. +All four are written. The ``##`` headings are the shape each page was written into, +and they are load-bearing beyond the eye: the screen records where each one landed while +rendering, which is what lets it pin the heading a reader is under and step the section +jump from one to the next — so a page is navigable the way a grouped list is. What is *not* written into those files: the version, the author, and the copyright span. Each page names them with a ``{version}`` / ``{author}`` / ``{copyright}`` placeholder diff --git a/tests/test_about.py b/tests/test_about.py index 01c0df1..ca45352 100644 --- a/tests/test_about.py +++ b/tests/test_about.py @@ -2,10 +2,9 @@ The pages carry no state and no controls, so what is worth pinning is what they *say* and how they are framed: the live package facts they must never drift from, the -empty-state voice their unwritten sections speak in, the derived footer that only names -the pager when there is something to page, the landmarks their written sections leave -for the sticky heading and the section jump, and the section they hang under in the main -menu. How markdown itself is drawn is ``test_markdown``'s subject; width discipline on +indent block their prose hangs in, the derived footer that only names the pager when +there is something to page, the landmarks their sections leave for the sticky heading +and the section jump, and the section they hang under in the main menu. How markdown itself is drawn is ``test_markdown``'s subject; width discipline on both platforms is the gallery's (``test_gallery``). """ @@ -48,54 +47,59 @@ def test_about_author_names_the_author_from_the_package() -> None: assert __author__ in _page(about_author) -@pytest.mark.parametrize( - ("builder", "headings"), - [ - (about_meshterm, ("What it is", "Where it came from", "Licence")), - (about_author, ("Who", "On the mesh", "Elsewhere")), +#: Every ``##`` a written page carries, in the order the reader meets them. These are +#: the page's landmarks, so one list answers both questions asked of them below: that +#: they render in order, and that each one is a stop the sticky heading can pin. +PAGE_HEADINGS = [ + ( + about_meshterm, ( - support_project, - ("Why it needs support", "Chip in", "Other ways to help"), + "What it is", + "Where it came from", + "Platform-specific developments", + "What the future holds", + "Licence", ), - ], -) + ), + ( + about_author, + ( + "Who am I IRL", + "Who am I on the mesh", + "On the subject of AI assisted development", + "How to reach me", + ), + ), + (support_project, ("Why it needs support", "Chip in", "Other ways to help")), +] + + +@pytest.mark.parametrize(("builder", "headings"), PAGE_HEADINGS) def test_each_page_shows_its_sections(builder, headings) -> None: # noqa: ANN001 - """The headings are the settled part of a scaffolded page — they render, in order.""" + """The headings are the shape a page is written into — they render, in order.""" text = _page(builder) at = [text.index(heading) for heading in headings] assert at == sorted(at), f"{headings} are out of order in the rendered page" -@pytest.mark.parametrize("builder", [about_author, support_project]) -def test_unwritten_sections_speak_the_empty_state_voice(builder) -> None: # noqa: ANN001 - """Placeholders read as deliberately unwritten: lowercase, em-dashed, unparenthesized. - - The app's empty-state rule (see the UX standards in ``CLAUDE.md``) is what keeps a - scaffolded page from looking like a screen that failed to load. *About MeshTerm* is - written now and so has none; these two are still scaffolding. - """ - text = _page(builder) - placeholders = [line for line in text.splitlines() if "placeholder" in line] - - assert placeholders, "a scaffolded page must say so" - for line in placeholders: - body = line.strip() - assert body.startswith("placeholder — "), body - assert "(" not in body and ")" not in body, body - - def test_prose_wraps_into_its_own_indented_block() -> None: - """A wrapped placeholder hangs under its heading rather than falling to column 0.""" + """A wrapped paragraph hangs under its heading rather than falling to column 0. + + *Support MeshTerm* is the page to ask: every one of its sections is plain prose and + it carries neither of the two blocks that are page frame rather than body (the + standfirst and the colophon, which sit flush by design), so the only thing entitled + to column 0 there is a ``##`` heading. + """ screen = AboutPage("Support MeshTerm", support_project()) screen.note_viewport(40) - # Narrow enough to force every placeholder to wrap at least once. + # Narrow enough to force every paragraph to wrap several times. lines = plain(screen.render_body(28)).splitlines() - wrapped = [line for line in lines if line.strip() and not line.startswith(" ")] - assert all( - "placeholder" not in line for line in wrapped - ), "prose escaped its indent block" + headings = {lines[at].strip() for at, _ in screen._sticky_headers} + flush = [line.strip() for line in lines if line.strip() and not line.startswith(" ")] + assert flush, "the page rendered nothing at all" + assert all(line in headings for line in flush), "prose escaped its indent block" def test_footer_names_the_pager_only_when_there_is_something_to_page() -> None: @@ -123,8 +127,15 @@ def test_the_licence_section_states_the_terms_and_the_credit_it_owes() -> None: """ prose = " ".join(_page(about_meshterm).split()) - for owed in ("MIT licence", "MeshCore", "OpenStreetMap contributors", "ODbL"): - assert owed in prose, owed + owed = ( + "Apache License, Version 2.0", + "MeshTerm and its logo are trademarks", + "MeshCore", + "OpenStreetMap contributors", + "ODbL", + ) + for credit in owed: + assert credit in prose, credit def test_the_discord_page_carries_the_invite_link_and_a_code_to_scan_it_with() -> None: @@ -152,14 +163,7 @@ def test_no_package_placeholder_survives_into_the_rendered_page() -> None: assert "{" not in text and "}" not in text, text -@pytest.mark.parametrize( - ("builder", "headings"), - [ - (about_meshterm, ("What it is", "Where it came from", "Licence")), - (about_author, ("Who", "On the mesh", "Elsewhere")), - (support_project, ("Why it needs support", "Chip in", "Other ways to help")), - ], -) +@pytest.mark.parametrize(("builder", "headings"), PAGE_HEADINGS) def test_each_section_heading_is_a_landmark_the_page_can_pin(builder, headings) -> None: # noqa: ANN001 """A page is a document, so its ``##`` headings pin and its ^PgUp/^PgDn steps by them.