This commit is contained in:
toom1996
2026-09-21 15:56:29 +08:00
parent b99dc3dca1
commit d1e42ea18a
5 changed files with 472 additions and 21 deletions

View File

@ -1204,6 +1204,7 @@ code{font-family:ui-monospace,Menlo,monospace;font-size:12px}
.badge.pending{background:#fff4e0;color:#a85b00}
.badge.approved{background:#e6f7ec;color:#1a7f43}
.badge.rejected{background:#fdeaea;color:#c0392b}
.badge.dup{background:#f3e8ff;color:#6b21a8}
.kind{font-size:12px;padding:1px 7px;border-radius:10px;background:#eef2ff;color:#3b4bb5}
.kind.street{background:#eafaf0;color:#1a7f43}
a.view{color:#111;text-decoration:underline}

View File

@ -0,0 +1,25 @@
package handler
import "testing"
// TestBackstageTemplatesParse 所有内嵌后台模板必须能解析。
//
// 模板是 Go 字符串常量,语法错误不会在编译期暴露——只会在用户打开页面时 500;
// 而审核页又有登录中间件挡着(curl 只能打到 302),冒烟测试覆盖不到,故用解析测试兜住。
func TestBackstageTemplatesParse(t *testing.T) {
for name, tpl := range map[string]string{
"login": tplLogin,
"reviewList": tplReviewList,
"reviewDetail": tplReviewDetail,
} {
t.Run(name, func(t *testing.T) {
base, err := pagerTmpl.Clone()
if err != nil {
t.Fatalf("clone pager 模板失败: %v", err)
}
if _, err := base.Parse(tpl); err != nil {
t.Fatalf("模板 %s 解析失败: %v", name, err)
}
})
}
}