Files
openmlsys-zh/tests/test_dark_mode_images_css.py
Yeqi Huang d12d14a1eb refactor: symmetric config layout and root CONTRIBUTING docs (#502)
* refactor: reorganize mdbook config and contributing docs

* fix: correct preprocessor relative paths in book.toml configs

The preprocessor command paths had one extra ../ level, resolving
outside the repo root. Fix from ../../../../tools/ to ../../../tools/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:07:53 +00:00

33 lines
1.3 KiB
Python

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 / "v1" / "config" / "en_config" / "theme" / "dark-mode-images.css",
REPO_ROOT / "v1" / "config" / "zh_config" / "theme" / "dark-mode-images.css",
REPO_ROOT / "v2" / "config" / "en_config" / "theme" / "dark-mode-images.css",
REPO_ROOT / "v2" / "config" / "zh_config" / "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()