1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/appsettings/test_themes.py
catborise d4f04cbf1e build(deps): Bootstrap and Bootswatch 5.3.8
Bootstrap SCSS, the JS bundle and the Bootswatch themes go from 5.3.3 to
5.3.8 (bug fixes only), and wvc-main.min.css is recompiled from zephyr.
Bootswatch now gives table text the body color, and Lux drops card and
modal header borders.

Tests compile every theme with the pinned libsass and check that the
shipped CSS is zephyr from these sources. The update and rollback steps
put back the two files a theme change rewrites, or git refuses to pull
over them.
2026-10-12 08:44:31 +03:00

33 lines
1.2 KiB
Python

"""The themes in dev/scss/wvc-themes compile with the pinned libsass, and the
shipped wvc-main.min.css is the default theme compiled from these sources."""
from pathlib import Path
import sass
from django.conf import settings
from django.test import SimpleTestCase
SCSS = Path(settings.BASE_DIR, "dev", "scss")
def compile_theme(theme):
# the imports the settings view compiles
return sass.compile(
string=f"@import '{SCSS}/wvc-themes/{theme}/variables';\n"
f"@import '{SCSS}/bootstrap-overrides.scss';\n"
f"@import '{SCSS}/wvc-themes/{theme}/bootswatch';",
output_style="compressed",
)
class ThemeTests(SimpleTestCase):
def test_every_theme_compiles(self):
themes = sorted(p.name for p in (SCSS / "wvc-themes").iterdir() if p.is_dir())
self.assertIn("zephyr", themes)
for theme in themes:
with self.subTest(theme=theme):
self.assertIn(".btn", compile_theme(theme))
def test_the_shipped_css_is_zephyr_from_these_sources(self):
shipped = Path(settings.BASE_DIR, "static", "css", "wvc-main.min.css").read_text()
self.assertEqual(shipped, compile_theme("zephyr"))