Add built-in white and black themes

This commit is contained in:
eezd committed 2026-10-20 10:26:49 +08:00
1 parent 7f65162115
commit 9fd7e2a948
6 files changed
+103 -5

No files matched your search

+7 -1
View File
@@ -29,9 +29,15 @@ func TestThemeAndShareAppearanceBoundaries(t *testing.T) {
t.Fatalf("匿名用户不应读取主题,得到 %d", code)
}
themes := decode[struct{ Themes []themeManifest }](t, f.do(f.admin, "GET", "/api/v1/themes", "", nil))
if len(themes.Themes) != 2 || themes.Themes[1].ID != "paper" {
if len(themes.Themes) != 4 || themes.Themes[0].ID != "default" || themes.Themes[1].ID != "white" || themes.Themes[2].ID != "black" || themes.Themes[3].ID != "paper" {
t.Fatalf("主题列表错误:%+v", themes.Themes)
}
for _, id := range []string{"white", "black"} {
theme := decode[map[string]string](t, f.do(f.admin, "GET", "/api/v1/themes/"+id, "", nil))
if theme["id"] != id || !strings.Contains(theme["css"], "--rm-bg:") {
t.Fatalf("内置主题未提供配色:%s", id)
}
}
theme := decode[map[string]string](t, f.do(f.admin, "GET", "/api/v1/themes/paper", "", nil))
if !strings.Contains(theme["css"], "#faf6ed") {
t.Fatal("未读取到主题 CSS")