feat: theme - 01
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -151,10 +151,10 @@ class SettingsApiGoldenTest(unittest.TestCase):
|
||||
self.assertEqual(response.json()["selected_color_mode"], "dark")
|
||||
|
||||
def test_settings_selected_theme_persistence(self) -> None:
|
||||
response = self._request("POST", "/api/settings", {"selected_theme": "default"})
|
||||
response = self._request("POST", "/api/settings", {"selected_theme": "midnight"})
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()["selected_theme"], "default")
|
||||
self.assertEqual(response.json()["selected_theme"], "midnight")
|
||||
self.assertEqual(response.json()["selected_color_mode"], "dark")
|
||||
|
||||
def test_settings_selected_color_mode_persistence(self) -> None:
|
||||
|
||||
@@ -26,6 +26,12 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertTrue(index_path.exists())
|
||||
|
||||
body = index_path.read_text(encoding="utf-8")
|
||||
self.assertIn('/ui/base.css', body)
|
||||
self.assertIn('/ui/theme-default.css', body)
|
||||
self.assertIn('/ui/theme-macos-soft.css', body)
|
||||
self.assertIn('/ui/theme-midnight.css', body)
|
||||
self.assertIn('/ui/theme-graphite.css', body)
|
||||
self.assertIn('/ui/theme-windows11.css', body)
|
||||
self.assertIn('id="workspace"', body)
|
||||
self.assertIn('id="footer-bar"', body)
|
||||
self.assertIn('id="title-zone-actions"', body)
|
||||
@@ -71,6 +77,11 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertIn("Show thumbnails", body)
|
||||
self.assertIn('id="settings-selected-theme"', body)
|
||||
self.assertIn("Theme", body)
|
||||
self.assertIn('value="default"', body)
|
||||
self.assertIn('value="macos-soft"', body)
|
||||
self.assertIn('value="midnight"', body)
|
||||
self.assertIn('value="graphite"', body)
|
||||
self.assertIn('value="windows11"', body)
|
||||
self.assertNotIn('id="settings-selected-color-mode"', body)
|
||||
self.assertIn('id="settings-startup-path-left"', body)
|
||||
self.assertIn('id="settings-startup-path-right"', body)
|
||||
@@ -121,11 +132,19 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
mount = self._ui_mount()
|
||||
static_root = Path(mount.app.directory)
|
||||
self.assertTrue((static_root / "app.js").exists())
|
||||
self.assertTrue((static_root / "style.css").exists())
|
||||
self.assertTrue((static_root / "base.css").exists())
|
||||
self.assertTrue((static_root / "theme-default.css").exists())
|
||||
self.assertTrue((static_root / "theme-macos-soft.css").exists())
|
||||
self.assertTrue((static_root / "theme-midnight.css").exists())
|
||||
self.assertTrue((static_root / "theme-graphite.css").exists())
|
||||
self.assertTrue((static_root / "theme-windows11.css").exists())
|
||||
app_js = (static_root / "app.js").read_text(encoding="utf-8")
|
||||
self.assertIn('currentPath: "/Volumes"', app_js)
|
||||
self.assertIn('selectedTheme: "default"', app_js)
|
||||
self.assertIn('selectedColorMode: "dark"', app_js)
|
||||
self.assertIn('const VALID_THEME_FAMILIES = ["default", "macos-soft", "midnight", "graphite", "windows11"];', app_js)
|
||||
self.assertIn('document.documentElement.dataset.themeFamily', app_js)
|
||||
self.assertIn('document.documentElement.dataset.colorMode', app_js)
|
||||
self.assertIn('function effectiveThemeKey(theme, colorMode)', app_js)
|
||||
self.assertIn("document.documentElement.dataset.theme", app_js)
|
||||
self.assertIn('document.getElementById("theme-toggle").onclick = toggleTheme;', app_js)
|
||||
@@ -193,26 +212,37 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertIn('sources: selectedItems.map((item) => item.path)', app_js)
|
||||
self.assertIn("function rootKeyFromPath(path)", app_js)
|
||||
self.assertIn("function isNestedPath(sourcePath, destinationPath)", app_js)
|
||||
style_css = (static_root / "style.css").read_text(encoding="utf-8")
|
||||
self.assertIn(':root[data-theme="default-dark"]', style_css)
|
||||
self.assertIn(':root[data-theme="default-light"]', style_css)
|
||||
self.assertIn('#theme-toggle', style_css)
|
||||
self.assertIn('.settings-card', style_css)
|
||||
self.assertIn('.settings-tabs', style_css)
|
||||
self.assertIn('.entry-media-slot', style_css)
|
||||
self.assertIn('.entry-media-icon.folder', style_css)
|
||||
self.assertIn('.entry-media-icon.video', style_css)
|
||||
self.assertIn('.entry-media-icon.pdf', style_css)
|
||||
self.assertIn('.entry-media-svg', style_css)
|
||||
self.assertIn('.entry-media-icon.file', style_css)
|
||||
self.assertIn('.editor-card', style_css)
|
||||
self.assertIn('.editor-host', style_css)
|
||||
self.assertNotIn('.select-marker', style_css)
|
||||
base_css = (static_root / "base.css").read_text(encoding="utf-8")
|
||||
default_theme_css = (static_root / "theme-default.css").read_text(encoding="utf-8")
|
||||
macos_theme_css = (static_root / "theme-macos-soft.css").read_text(encoding="utf-8")
|
||||
midnight_theme_css = (static_root / "theme-midnight.css").read_text(encoding="utf-8")
|
||||
graphite_theme_css = (static_root / "theme-graphite.css").read_text(encoding="utf-8")
|
||||
windows_theme_css = (static_root / "theme-windows11.css").read_text(encoding="utf-8")
|
||||
self.assertIn('#theme-toggle', base_css)
|
||||
self.assertIn('.settings-card', base_css)
|
||||
self.assertIn('.settings-tabs', base_css)
|
||||
self.assertIn('.entry-media-slot', base_css)
|
||||
self.assertIn('.entry-media-icon.folder', base_css)
|
||||
self.assertIn('.entry-media-icon.video', base_css)
|
||||
self.assertIn('.entry-media-icon.pdf', base_css)
|
||||
self.assertIn('.entry-media-svg', base_css)
|
||||
self.assertIn('.entry-media-icon.file', base_css)
|
||||
self.assertIn('.editor-card', base_css)
|
||||
self.assertIn('.editor-host', base_css)
|
||||
self.assertNotIn('.select-marker', base_css)
|
||||
self.assertIn(':root[data-theme-family="default"][data-color-mode="dark"]', default_theme_css)
|
||||
self.assertIn(':root[data-theme-family="default"][data-color-mode="light"]', default_theme_css)
|
||||
self.assertIn(':root[data-theme-family="macos-soft"][data-color-mode="dark"]', macos_theme_css)
|
||||
self.assertIn(':root[data-theme-family="midnight"][data-color-mode="dark"]', midnight_theme_css)
|
||||
self.assertIn(':root[data-theme-family="graphite"][data-color-mode="dark"]', graphite_theme_css)
|
||||
self.assertIn(':root[data-theme-family="windows11"][data-color-mode="dark"]', windows_theme_css)
|
||||
|
||||
app_js_url = app.url_path_for("ui", path="/app.js")
|
||||
style_css_url = app.url_path_for("ui", path="/style.css")
|
||||
base_css_url = app.url_path_for("ui", path="/base.css")
|
||||
theme_default_url = app.url_path_for("ui", path="/theme-default.css")
|
||||
self.assertEqual(app_js_url, "/ui/app.js")
|
||||
self.assertEqual(style_css_url, "/ui/style.css")
|
||||
self.assertEqual(base_css_url, "/ui/base.css")
|
||||
self.assertEqual(theme_default_url, "/ui/theme-default.css")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user