fix and test the linking to the style switcher

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
2025-03-17 00:47:00 -05:00
parent 41350d4b7a
commit f3eed9d4f2
2 changed files with 15 additions and 3 deletions

View File

@@ -56,6 +56,10 @@ def test_page_includes_themes_with_default():
in handle_markdown_file_path('index.md')
assert '<link rel="alternate stylesheet" type="text/css" title="dark" href="/static/css/dark.css">'\
in handle_markdown_file_path('index.md')
assert '<a href="" onclick="setStyle(\'light\'); return false;">[light]</a>'\
in handle_markdown_file_path('index.md')
assert '<a href="" onclick="setStyle(\'dark\'); return false;">[dark]</a>'\
in handle_markdown_file_path('index.md')
def test_render_with_style_overrides():
@@ -65,6 +69,10 @@ def test_render_with_style_overrides():
in handle_markdown_file_path('index.md')
assert '<link rel="alternate stylesheet" type="text/css" title="light" href="/static/css/light.css">'\
in handle_markdown_file_path('index.md')
assert '<a href="" onclick="setStyle(\'light\'); return false;">[light]</a>'\
in handle_markdown_file_path('index.md')
assert '<a href="" onclick="setStyle(\'dark\'); return false;">[dark]</a>'\
in handle_markdown_file_path('index.md')
def test_render_with_default_style_override():
@@ -78,6 +86,10 @@ def test_render_with_default_style_override():
in handle_markdown_file_path('index.md')
assert '<link rel="alternate stylesheet" type="text/css" title="light" href="/static/css/light.css">'\
not in handle_markdown_file_path('index.md')
assert '<a href="" onclick="setStyle(\'warm\'); return false;">[warm]</a>'\
in handle_markdown_file_path('index.md')
assert '<a href="" onclick="setStyle(\'cool\'); return false;">[cool]</a>'\
in handle_markdown_file_path('index.md')
def test_redirects_error_unsupported():