fix and test the linking to the style switcher
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
41350d4b7a
commit
f3eed9d4f2
@ -69,10 +69,10 @@ applyStyleFromCookie();
|
||||
{% if not loop.last %} » {% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if page_styles %}
|
||||
{% if config.PAGE_STYLES %}
|
||||
<div class="styles">
|
||||
{% for style in page_styles %}
|
||||
<a href="#" onclick="setStyle('{{ style }}'); return false;">[{{ style }}]</a>
|
||||
{% for style, stylesheet in config.PAGE_STYLES.items() %}
|
||||
<a href="" onclick="setStyle('{{ style }}'); return false;">[{{ style }}]</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user