Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

test(web): 类名覆盖门槛纳入 island 源码,删掉取不到的厂牌回退断言

longmeidao32d70c9d23ed
diff --git a/tests/test_studio_icon_variants.py b/tests/test_studio_icon_variants.py
index bee018ce7..8e3498439 100644
--- a/tests/test_studio_icon_variants.py
+++ b/tests/test_studio_icon_variants.py
@@ -123,8 +123,11 @@ class PageSourceTests(unittest.TestCase):
'/logo?studio=115&variant=icon',
'/logo?studio=${encodeURIComponent(x.k)}&variant=icon',
'/logo?studio=${encodeURIComponent(item.name)}&variant=icon',
- "'/logo?studio='+encodeURIComponent(img.dataset.studio)+'&variant=icon'",
):
+ # 原先还有第四处:`.entityfavicon` 的 error 监听里按 `img.dataset.studio`
+ # 换厂牌图标。那个分支取不到——两处生成 `.entityfavicon` 的模板都不写
+ # `data-studio`,条件永远为假。监听整块已随图片回退改成声明式而删除;
+ # 「不许漏 variant」由下面那条按行扫描的断言守,重新加回来也拦得住。
with self.subTest(snippet=snippet):
self.assertIn(snippet, self.source)
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 09d055501..c7458d50c 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -74,7 +74,13 @@ class WebUiSourceTests(unittest.TestCase):
cls.page_shape = code_shape(cls.page)
# 「谁用到了这个类名」只能问模板一侧。样式表自己不算——把 app.css 也接进来
# 比对,每个选择器都会匹配到它自己的定义。
+ # island(ADR-0022)也是模板一侧:高清版目标页的 DOM 现在由 frontend 里的
+ # Preact 组件产出,样式仍留在 app.css。不把它接进来的话,迁走的那几组类会
+ # 被误判成没人用,然后有人真的把还在生效的样式删掉。
markup = [web / "index.html", web / "app.js", *sorted((web / "js").glob("*.js"))]
+ island_src = Path(__file__).resolve().parents[1] / "frontend" / "src"
+ markup.extend(sorted(path for suffix in ("*.ts", "*.tsx")
+ for path in island_src.rglob(suffix)))
cls.markup = chr(10).join(path.read_text(encoding="utf-8") for path in markup)
# 页面源断言必须自带有界失败信息。assertIn 失败时会把整个 index.html(约 189 KB)