diff --git a/internal/web/fillup_test.go b/internal/web/fillup_test.go index d728505..a9bfc9f 100644 --- a/internal/web/fillup_test.go +++ b/internal/web/fillup_test.go @@ -301,3 +301,24 @@ func TestFillupCustomActivityEmptyIsSkipped(t *testing.T) { t.Fatalf("没填名字不该建类型,活动数 %d → %d", before, n) } } + +// 「手工填过的值自动进候选」是纯前端行为,Go 测不到运行时,只能钉住它还在模板里。 +// 这东西少一半都不会报错,只会悄悄退回「后面每行都得重新打一遍」—— +// 所以把三个关键标记都钉住:存下来的键、注入选项的标记、显示用的前缀。 +func TestFillupKeepsHandwrittenCandidates(t *testing.T) { + f := newMovementFixture(t) + fillupPlace(t, f) + + rec := httptest.NewRecorder() + req := httptest.NewRequest("GET", "/admin/fillup", nil).WithContext(f.ctx) + f.srv.adminFillupPage(rec, req) + if rec.Code != http.StatusOK { + t.Fatalf("渲染失败: %d", rec.Code) + } + body := rec.Body.String() + for _, want := range []string{"rond-fillup-newopts", "data-local", "新填:"} { + if !strings.Contains(body, want) { + t.Errorf("模板里找不到 %q —— 「手工填过的值自动进候选」失效了", want) + } + } +} diff --git a/internal/web/templates/admin/fillup.html b/internal/web/templates/admin/fillup.html index e0ee1a3..2b9bb65 100644 --- a/internal/web/templates/admin/fillup.html +++ b/internal/web/templates/admin/fillup.html @@ -113,6 +113,7 @@