Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve committed Apr 22, 2024
1 parent 883a0d4 commit cfdd0ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The ``BOOTSTRAP5`` dict variable contains these settings and defaults:
# The complete URL to the Bootstrap CSS theme file (None means no theme).
"theme_url": None,
# Theme color: light, dark https://getbootstrap.com/docs/5.3/customize/color-modes/
# Color mode (None means do not set color mode).
"color_mode": None,
# Put JavaScript in the HEAD section of the HTML document (only relevant if you use bootstrap5.html).
Expand Down
13 changes: 13 additions & 0 deletions tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ def test_empty_template(self):
def test_text_template(self):
self.assertEqual(self.render("some text").strip(), "some text")

def test_bootstrap5_html_template_color_mode(self):
html = self.render(
'{% extends "django_bootstrap5/bootstrap5.html" %}',
load_bootstrap=False,
)
self.assertNotIn("data-bs-theme", html)
with self.settings(BOOTSTRAP5={"color_mode": "dark"}):
html = self.render(
'{% extends "django_bootstrap5/bootstrap5.html" %}',
load_bootstrap=False,
)
self.assertIn('data-bs-theme="dark"', html)

def test_bootstrap5_html_template_title(self):
html = self.render(
'{% extends "django_bootstrap5/bootstrap5.html" %}{% block bootstrap5_title %}x-title-x{% endblock %}',
Expand Down

0 comments on commit cfdd0ce

Please sign in to comment.