site: take the six doors off the landing page
The page is now three things: what bench is, what installing costs, and why to bother. The header nav is the way into the docs. Removing them takes their CSS with them (.doors/.door* in the base sheet and in all three breakpoints) and two tests that existed only for them — the six-are-distinct check here and TheDoorsOpenOntoArticles in test_site_pages. The hero-buttons test survives its class, renamed to say what it now guards: the landing page's only links into the docs. One test needed retargeting rather than deleting. test_it_fails_before_anything_is_written removed /concepts/team-mode/ from the manifest to prove a dead internal link stops the build before anything is written — but the link it relied on was a door. It now aims at /guides/install/, which the hero button still hard-links. Side effect worth having: the two reasons in "Why bench?" that nearly repeated doors 03 and 04 no longer sit above them.
This commit is contained in:
@@ -11,8 +11,8 @@ Three promises, each mechanised below:
|
||||
held against the source that prints it — install.py's setup questions,
|
||||
board.py's startup. A reworded prompt fails here rather than quietly
|
||||
turning the strongest thing on the page into fiction.
|
||||
- **Every door opens.** The six cards point at routes this build writes,
|
||||
and a link that resolves to nothing fails the build instead of shipping.
|
||||
- **Its links go somewhere.** A link that resolves to nothing fails the
|
||||
build instead of shipping.
|
||||
|
||||
python3 -m unittest discover -s tests
|
||||
"""
|
||||
@@ -135,24 +135,9 @@ class TheTerminalIsATranscript(LandingCase):
|
||||
self.assertIn("abridged", self.home)
|
||||
|
||||
|
||||
class TheDoorsOpen(LandingCase):
|
||||
"""Six doors, each a page this site builds."""
|
||||
|
||||
def doors(self) -> list:
|
||||
return re.findall(r'<a class="door[^"]*" href="([^"]+)"', self.home)
|
||||
|
||||
def test_there_are_six_and_they_are_distinct(self):
|
||||
self.assertEqual(6, len(self.doors()))
|
||||
self.assertEqual(6, len(set(self.doors())))
|
||||
|
||||
def test_each_one_is_a_route_the_build_writes(self):
|
||||
routes = {page["path"] for page in self.manifest["pages"]}
|
||||
for door in self.doors():
|
||||
with self.subTest(door=door):
|
||||
self.assertIn(door, routes)
|
||||
self.assertTrue(
|
||||
BUILDER.target_for(self.out, door).is_file(),
|
||||
f"{door} is in the manifest but produced no page")
|
||||
class TheHeroLeadsSomewhere(LandingCase):
|
||||
"""The landing page's only links into the docs, now that the six
|
||||
doors are gone: these two buttons and the header nav."""
|
||||
|
||||
def test_both_hero_buttons_go_somewhere_real(self):
|
||||
"""One to the install guide, one to the repository."""
|
||||
@@ -286,10 +271,12 @@ class ADeadInternalLinkStopsTheBuild(ScratchCase):
|
||||
self.assertIn("does not write", result.stderr)
|
||||
|
||||
def test_it_fails_before_anything_is_written(self):
|
||||
"""As drift does: the last good build stays up."""
|
||||
"""As drift does: the last good build stays up. Aimed at the
|
||||
install guide because the hero button hard-links it — the
|
||||
landing page's other internal links went with the doors."""
|
||||
manifest = self.repo.manifest()
|
||||
manifest["pages"] = [page for page in manifest["pages"]
|
||||
if page["path"] != "/concepts/team-mode/"]
|
||||
if page["path"] != "/guides/install/"]
|
||||
self.repo.write_manifest(manifest)
|
||||
self.repo.build()
|
||||
self.assertFalse(self.repo.out.exists(),
|
||||
|
||||
@@ -32,7 +32,6 @@ HEADING_ID = re.compile(r'<h2 id="([^"]+)"')
|
||||
TOC_LINK = re.compile(r'class="toc-link" href="#([^"]+)"')
|
||||
SIDE_HERE = re.compile(r'class="side-link side-here" href="([^"]+)"')
|
||||
GUTTER_LINK = re.compile(r'class="gutter-link" href="([^"]+)"')
|
||||
DOOR = re.compile(r'class="door[^"]*" href="([^"]+)"')
|
||||
LEDE = re.compile(r'<p class="prose-lede">(.*?)</p>', re.S)
|
||||
# Both rails are written twice — the column the design draws, and the
|
||||
# folded <details> strip that replaces it below the breakpoint. So these
|
||||
@@ -269,19 +268,6 @@ class EditThisPageOpensTheSection(BuiltSite):
|
||||
'class="gutter-link" href="')[-1].split('"')[0])
|
||||
|
||||
|
||||
class TheDoorsOpenOntoArticles(BuiltSite):
|
||||
"""Task 33 put six doors on the landing page. This is the other end of
|
||||
them."""
|
||||
|
||||
def test_every_door_lands_on_a_page_in_the_flow(self):
|
||||
routes = {entry["path"] for entry in self.flow}
|
||||
doors = DOOR.findall(self.page("/"))
|
||||
self.assertEqual(6, len(doors))
|
||||
for door in doors:
|
||||
self.assertIn(door, routes,
|
||||
f"the door to {door} opens onto nothing")
|
||||
|
||||
|
||||
@needs_renderer
|
||||
class MarkdownComesOutAsMarkup(BuiltSite):
|
||||
"""The edge case: a table, a fenced code block and a nested list have
|
||||
|
||||
Reference in New Issue
Block a user