mirror of
https://github.com/openmlsys/openmlsys-zh.git
synced 2026-04-25 02:52:57 +08:00
fix: restore dark mode body image backgrounds
Apply light gray backgrounds to body images in dark themes for both English and Chinese mdBook themes while explicitly excluding homepage frontpage images.
This commit is contained in:
30
tests/test_dark_mode_images_css.py
Normal file
30
tests/test_dark_mode_images_css.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class DarkModeImagesCssTests(unittest.TestCase):
|
||||
def test_both_theme_css_files_style_dark_mode_body_images_only(self) -> None:
|
||||
css_paths = [
|
||||
REPO_ROOT / "theme" / "dark-mode-images.css",
|
||||
REPO_ROOT / "books" / "zh" / "theme" / "dark-mode-images.css",
|
||||
]
|
||||
|
||||
for css_path in css_paths:
|
||||
css = css_path.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn(".navy .content main img", css, css_path.as_posix())
|
||||
self.assertIn(".coal .content main img", css, css_path.as_posix())
|
||||
self.assertIn(".ayu .content main img", css, css_path.as_posix())
|
||||
self.assertIn("background-color: #e8e8e8;", css, css_path.as_posix())
|
||||
self.assertIn(".openmlsys-frontpage img", css, css_path.as_posix())
|
||||
self.assertIn("background-color: transparent !important;", css, css_path.as_posix())
|
||||
self.assertIn("padding: 0 !important;", css, css_path.as_posix())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user