-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtest_show_footer.py
More file actions
39 lines (31 loc) Β· 1.67 KB
/
Copy pathtest_show_footer.py
File metadata and controls
39 lines (31 loc) Β· 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Tests for PR #32 β show_footer config option."""
import yaml
from pathlib import Path
THEME_YML = Path(__file__).parent.parent / "mkdocs_dracula_theme" / "mkdocs_theme.yml"
FOOTER_TEXT = "Made with Dracula Theme for MkDocs"
class TestShowFooterDefault:
def test_default_config_declares_show_footer(self):
"""mkdocs_theme.yml must declare show_footer key."""
config = yaml.safe_load(THEME_YML.read_text())
assert "show_footer" in config, "show_footer key missing from mkdocs_theme.yml"
def test_default_value_is_true(self):
"""Default value of show_footer must be True (backwards-compatible)."""
config = yaml.safe_load(THEME_YML.read_text())
assert config["show_footer"] is True
def test_footer_rendered_by_default(self, build_site):
"""Footer is visible when show_footer is not set."""
html = build_site()
assert FOOTER_TEXT in html
def test_footer_rendered_when_explicitly_true(self, build_site):
"""Footer is visible when show_footer: true."""
html = build_site("show_footer: true")
assert FOOTER_TEXT in html
def test_footer_hidden_when_false(self, build_site):
"""Footer is absent when show_footer: false."""
html = build_site("show_footer: false")
assert FOOTER_TEXT not in html
def test_base_template_has_conditional(self):
"""base.html must wrap the footer include with show_footer conditional."""
base = (Path(__file__).parent.parent / "mkdocs_dracula_theme" / "base.html").read_text()
assert "config.theme.show_footer" in base, \
"base.html must guard the footer include with {% if config.theme.show_footer %}"