diff --git a/docs/settings.rst b/docs/settings.rst index af10c285..f8f3bbed 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -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). diff --git a/tests/test_templates.py b/tests/test_templates.py index c609754f..e55d0d02 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -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 %}',