Add optional subtitle to recipes, display under title, omit from TOC

This commit is contained in:
2026-10-17 17:20:02 +02:00
parent 814fd54d75
commit f8e5525847
9 changed files with 223 additions and 11 deletions
+18
View File
@@ -41,6 +41,24 @@ def test_routes():
assert len(matches) == 0, f"Found {len(matches)} double numbers in /cookbook: {matches[:3]}"
print("✓ Zero double numbers in rendered /cookbook steps confirmed!")
# Verify subtitle behavior:
# 1. Kressesuppe is in TOC, without subtitle
toc_titles = re.findall(r'<span class="toc-rec-title">([^<]+)</span>', res_cb.text)
assert "Kressesuppe" in toc_titles, "Kressesuppe not found in TOC titles!"
assert "Kressesuppe mit Croutons" not in toc_titles, "Old combined title still in TOC!"
print("✓ TOC Title check: Only 'Kressesuppe' appears in TOC, not the subtitle.")
# 2. Recipe page renders title and subtitle
assert '<h3 class="recipe-title">Kressesuppe</h3>' in res_cb.text
assert '<div class="recipe-subtitle">mit Croutons</div>' in res_cb.text
print("✓ Cookbook recipe page check: Title is Kressesuppe, Subtitle is mit Croutons.")
# 3. Recipe detail page renders title and subtitle
res_detail = client.get("/cookbook/recipe/51")
assert '<h2 class="recipe-title">Kressesuppe</h2>' in res_detail.text
assert '<div class="recipe-subtitle">mit Croutons</div>' in res_detail.text
print("✓ Recipe detail page check: Title and subtitle present.")
print("\nAll route tests passed successfully!")
if __name__ == "__main__":