feat: 收敛店铺管理和蝦皮分类搜索 (#212 #213)

This commit is contained in:
chengma
2026-08-13 11:47:56 +08:00
parent 1abed648a5
commit 313e9f9151
22 changed files with 389 additions and 464 deletions
+10 -8
View File
@@ -65,7 +65,7 @@ func TestModuleNavigation_按账号保存稳定列表状态且安全回退(t *te
jsSource := string(js)
for _, want := range []string{
"var MODULE_QUERY_KEYS = {",
"\"/shopee\": [\"goods_id\", \"shop_name\", \"status\", \"shop\", \"image\", \"store\", \"deleted\", \"page\"]",
"\"/shopee\": [\"q\", \"search_field\", \"status\", \"deleted\", \"unlinked\", \"page\"]",
"\"/syb\": [\"order_no\", \"shop\", \"stage\", \"page\", \"date_from\", \"date_to\"]",
"var MODULE_STATE_PREFIX = \"cmautobuy:module-state:\"",
"parsed.origin !== window.location.origin || parsed.pathname !== moduleRoot",
@@ -316,7 +316,7 @@ func TestSybPage_明确展示蝦皮商品Pdd关联来源(t *testing.T) {
}
}
func TestShops_独立模块区分全局和SYB状态且保护删除(t *testing.T) {
func TestShops_单一名称和状态且保护删除(t *testing.T) {
templateContent, err := os.ReadFile("templates/shop/list.html")
if err != nil {
t.Fatal(err)
@@ -327,7 +327,7 @@ func TestShops_独立模块区分全局和SYB状态且保护删除(t *testing.T)
}
page := string(templateContent)
for _, want := range []string{
`{{if not .Enabled}}`, `action="/shops/delete"`, `action="/shops/syb-status"`,
`name="shop_name"`, `{{if not .Enabled}}`, `action="/shops/delete"`,
`data-confirm-submit="确定删除停用店铺“{{.DisplayName}}”吗?`,
`class="danger">删除`,
} {
@@ -338,6 +338,9 @@ func TestShops_独立模块区分全局和SYB状态且保护删除(t *testing.T)
if !strings.Contains(string(routes), `shops.POST("/delete", h.ShopDelete)`) {
t.Error("店铺删除没有挂到管理员路由组")
}
if strings.Contains(page, "业务店铺") || strings.Contains(page, "SYB 名称") || strings.Contains(page, "蝦皮名称") {
t.Error("店铺管理仍暴露已废弃的多名称概念")
}
}
func TestCatalogHistory_展示更新策略和分级统计(t *testing.T) {
@@ -382,7 +385,7 @@ func TestShopeePage_展示主图店铺且保留标题宽度(t *testing.T) {
}
}
func TestShopeePage_店铺图片三态筛选和状态保留(t *testing.T) {
func TestShopeePage_分类搜索回收站和状态保留(t *testing.T) {
list, err := os.ReadFile("templates/shopee/list.html")
if err != nil {
t.Fatal(err)
@@ -393,12 +396,11 @@ func TestShopeePage_店铺图片三态筛选和状态保留(t *testing.T) {
}
content := string(list) + string(detail)
for _, want := range []string{
`<label for="shop">店铺</label>`, `name="shop"`, `.ShopOptions`, `.ShopFilter`,
`<label for="image">图片</label>`, `name="image"`, `.ImageOptions`, `.ImageFilter`,
`清除筛选条件`,
`<label for="search-field">分类</label>`, `name="search_field"`,
`<label for="q">关键词</label>`, `name="q"`, `回收站`, `清除筛选条件`,
} {
if !strings.Contains(content, want) {
t.Errorf("蝦皮三态筛选界面缺少 %q", want)
t.Errorf("蝦皮分类搜索界面缺少 %q", want)
}
}
}