from __future__ import annotations import unittest from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parents[1] STATIC_ROOT = PROJECT_ROOT / "arr_web" / "static" class DailyVisualStaticContractTests(unittest.TestCase): @classmethod def setUpClass(cls) -> None: cls.html = (STATIC_ROOT / "index.html").read_text(encoding="utf-8") cls.styles = (STATIC_ROOT / "styles.css").read_text(encoding="utf-8") def test_daily_workspace_uses_one_clear_history_title(self) -> None: self.assertIn('ARR Report', self.html) self.assertIn('

Daily Report

', self.html) self.assertNotIn('

Daily Report

', self.html) self.assertNotIn('class="daily-section-heading"', self.html) self.assertNotIn("THIS MONTH", self.html) self.assertNotIn("日报处理记录", self.html) self.assertIn("font-size: clamp(20px, 1.75vw, 24px)", self.styles) def test_task_log_utility_is_a_low_emphasis_link(self) -> None: self.assertIn(' None: overview_start = self.html.index('
\n\n
.metric-card", self.styles) self.assertIn( ".daily-overview > .metric-card { align-self: stretch; display: flex; flex-direction: column; justify-content: center; height: auto; min-height: 0;", self.styles, ) self.assertIn(".daily-overview > .metric-card::after", self.styles) self.assertNotIn("width: max-content", self.styles) self.assertIn("height: auto; min-height: 0", self.styles) self.assertIn(".daily-overview { grid-template-columns: 1fr;", self.styles) self.assertIn("@media (min-width: 701px)", self.styles) self.assertIn(".daily-overview .dropzone {", self.styles) self.assertIn("grid-template-columns: 28px minmax(0, 1fr)", self.styles) self.assertIn("min-height: 72px", self.styles) self.assertIn(".daily-overview .upload-footer", self.styles) self.assertIn("min-height: 44px", self.styles) self.assertIn("min-width: 96px", self.styles) def test_upload_panel_has_compact_action_footer(self) -> None: self.assertIn('class="panel-heading upload-heading"', self.html) self.assertIn('class="upload-footer"', self.html) self.assertIn(".upload-panel .primary-button", self.styles) self.assertIn("min-width: 118px", self.styles) self.assertNotIn("width: calc(100% - 48px)", self.styles) def test_removed_upload_labels_do_not_return(self) -> None: upload_start = self.html.index('class="panel upload-panel"') upload_end = self.html.index("
", upload_start) upload_markup = self.html[upload_start:upload_end] self.assertNotIn("本月留痕", upload_markup) self.assertNotIn("01 / UPLOAD", upload_markup) if __name__ == "__main__": unittest.main(verbosity=2)