feat: tune visual of windows 95 theme
This commit is contained in:
@@ -163,7 +163,10 @@ class WebAppAssetTests(unittest.IsolatedAsyncioTestCase):
|
||||
with patch.object(admin_themes, "WEBAPP_FAVICON_DIR", Path(tmpdir)):
|
||||
payload = admin_themes._write_favicon_set(png_body, "image/png", "icon.png")
|
||||
|
||||
self.assertRegex(payload["favicon_url"], r"^/webapp-favicon/[0-9a-f]{16}/icon-180\.png$")
|
||||
self.assertRegex(
|
||||
payload["favicon_url"],
|
||||
r"^/webapp-favicon/[0-9a-f]{16}/icon-180\.png$",
|
||||
)
|
||||
digest = payload["favicon_url"].split("/")[2]
|
||||
self.assertTrue((Path(tmpdir) / digest / "icon-32.png").exists())
|
||||
self.assertTrue((Path(tmpdir) / digest / "apple-touch-icon.png").exists())
|
||||
@@ -390,6 +393,28 @@ class WebAppAssetTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(response.headers["Cache-Control"], "public, max-age=3600")
|
||||
self.assertEqual(response.body, b"png-bytes")
|
||||
|
||||
async def test_theme_asset_route_uses_immutable_cache_for_versioned_assets(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
themes_dir = Path(tmpdir)
|
||||
(themes_dir / "custom" / "icons").mkdir(parents=True)
|
||||
(themes_dir / "custom" / "icons" / "save.png").write_bytes(b"png-bytes")
|
||||
request = SimpleNamespace(
|
||||
app={
|
||||
"settings": SimpleNamespace(
|
||||
WEBAPP_ENABLED=True,
|
||||
WEBAPP_THEMES_DIR=str(themes_dir),
|
||||
)
|
||||
},
|
||||
match_info={"path": "custom/icons/save.png"},
|
||||
query={"v": "6"},
|
||||
)
|
||||
|
||||
response = await subscription_webapp.theme_asset_route(request)
|
||||
|
||||
self.assertEqual(
|
||||
response.headers["Cache-Control"], "public, max-age=31536000, immutable"
|
||||
)
|
||||
|
||||
async def test_theme_asset_route_serves_default_theme_icon_from_theme_folder(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
request = SimpleNamespace(
|
||||
|
||||
@@ -33,7 +33,7 @@ class WebappThemesConfigTests(unittest.TestCase):
|
||||
self.assertEqual(win95.tokens.style_preset, "win95")
|
||||
self.assertFalse(win95.use_primary_accent)
|
||||
self.assertTrue(win95.use_in_admin)
|
||||
self.assertEqual(win95.assets_version, 5)
|
||||
self.assertEqual(win95.assets_version, 6)
|
||||
ascii_theme = cfg.theme_by_key("ascii")
|
||||
self.assertIsNotNone(ascii_theme)
|
||||
self.assertEqual(ascii_theme.css_file, "style.css")
|
||||
@@ -380,13 +380,15 @@ class WebappThemesConfigTests(unittest.TestCase):
|
||||
descriptor["assets_version"],
|
||||
cfg.theme_by_key("windows95").assets_version,
|
||||
)
|
||||
self.assertEqual(descriptor["assets_version"], 5)
|
||||
self.assertEqual(descriptor["assets_version"], 6)
|
||||
self.assertIn("lucide-house", css)
|
||||
self.assertIn("lucide-earth", css)
|
||||
self.assertIn("lucide-circle-check", css)
|
||||
self.assertIn("lucide-circle-check-big", css)
|
||||
self.assertIn("filter: none !important", css)
|
||||
self.assertIn("Press Start 2P", css)
|
||||
self.assertIn("::-webkit-slider-thumb", css)
|
||||
self.assertIn("?v=6", css)
|
||||
self.assertIn(".theme-key-windows95 .traffic-top strong", css)
|
||||
self.assertTrue((stale_theme_dir / "icons" / "dashboard.png").exists())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user