Link the left-out list from the no-results state, and the rules and changelog from the footer
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
985eaa2074
commit
0870287fe5
3 files changed
+25
-1
No files matched your search
@@ -605,6 +605,7 @@ def results(recs=None, *, finder=False, groups=None, routes_list=False, default_
|
||||
<div class="empty-state" id="empty-state" hidden>
|
||||
<p><strong>No {noun} match these filters.</strong></p>
|
||||
<button class="button button--quiet" type="button" data-reset>Clear search and filters</button>
|
||||
<p>Not finding a trail? <a href="/left-out/">Some are left out, with the reason for each.</a></p>
|
||||
</div>"""
|
||||
elif saved:
|
||||
count = '<p class="results-count" data-saved-total><strong>0</strong> trails</p>'
|
||||
|
||||
@@ -165,6 +165,8 @@ def footer(site):
|
||||
<li><a href="/sources/">Sources and their terms</a></li>
|
||||
<li><a href="/logos/">Logos</a></li>
|
||||
<li><a href="/left-out/">Considered and left out</a></li>
|
||||
<li><a href="/about/#how-trails-are-chosen">How trails are chosen</a></li>
|
||||
<li><a href="/data/changelog/">Changelog</a></li>
|
||||
{report}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
@@ -11,7 +11,7 @@ WEB = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
ROOT = os.path.dirname(WEB)
|
||||
sys.path.insert(0, WEB)
|
||||
|
||||
from olt import leftout, seo, site # noqa: E402
|
||||
from olt import home, layout, leftout, records, seo, site # noqa: E402
|
||||
|
||||
ENTRIES = [
|
||||
{
|
||||
@@ -102,5 +102,26 @@ class PageTest(unittest.TestCase):
|
||||
self.assertTrue(reasons <= set(leftout.REASON_ORDER))
|
||||
|
||||
|
||||
class ReachTest(unittest.TestCase):
|
||||
"""The list is linked where a visitor who cannot find a trail would look."""
|
||||
|
||||
def test_the_empty_state_of_every_list_of_trails_links_to_it(self):
|
||||
recs = records.load_records(ROOT)
|
||||
for finder in (True,):
|
||||
html = str(home.results(recs, finder=finder))
|
||||
empty = html[html.index('id="empty-state"'):]
|
||||
empty = empty[:empty.index("</div>")]
|
||||
self.assertIn("Not finding a trail?", empty)
|
||||
self.assertIn('<a href="/left-out/">Some are left out, with the reason for each.</a>', empty)
|
||||
# a list that is not driven by the filter bar has no empty state, so no link
|
||||
self.assertNotIn("/left-out/", str(home.results(recs)))
|
||||
|
||||
def test_the_footer_links_the_list_the_changelog_and_the_rules(self):
|
||||
footer = str(layout.footer(site.Site("N", "T")))
|
||||
self.assertIn('<a href="/left-out/">Considered and left out</a>', footer)
|
||||
self.assertIn('<a href="/data/changelog/">Changelog</a>', footer)
|
||||
self.assertIn('<a href="/about/#how-trails-are-chosen">How trails are chosen</a>', footer)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user