update
This commit is contained in:
@ -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}
|
||||
|
||||
25
internal/handler/backstage_handler_test.go
Normal file
25
internal/handler/backstage_handler_test.go
Normal 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user