mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-11 18:18:40 +00:00
refactor: form binding validation (#38832)
Make "form-fetch-action" highlight the invalid field as "error"
This commit is contained in:
@@ -53,7 +53,7 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
||||
OldRefSubURL: "branch/master",
|
||||
NewBranch: "",
|
||||
ExpectedStatus: http.StatusSeeOther,
|
||||
FlashMessage: translation.NewLocale("en-US").TrString("form.NewBranchName") + translation.NewLocale("en-US").TrString("form.require_error"),
|
||||
FlashMessage: translation.NewLocale("en-US").TrString("form.require_error", translation.NewLocale("en-US").TrString("form.NewBranchName")),
|
||||
},
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
@@ -65,7 +65,7 @@ func testCreateBranches(t *testing.T, giteaURL *url.URL) {
|
||||
OldRefSubURL: "branch/master",
|
||||
NewBranch: strings.Repeat("b", 101),
|
||||
ExpectedStatus: http.StatusSeeOther,
|
||||
FlashMessage: translation.NewLocale("en-US").TrString("form.NewBranchName") + translation.NewLocale("en-US").TrString("form.max_size_error", "100"),
|
||||
FlashMessage: translation.NewLocale("en-US").TrString("form.max_size_error", translation.NewLocale("en-US").TrString("form.NewBranchName"), "100"),
|
||||
},
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
|
||||
@@ -184,7 +184,7 @@ func testRenameInvalidUsername(t *testing.T) {
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
assert.Contains(t,
|
||||
htmlDoc.doc.Find(".ui.negative.message").Text(),
|
||||
translation.NewLocale("en-US").TrString("form.username_error"),
|
||||
translation.NewLocale("en-US").TrString("form.username_error", "Name"),
|
||||
)
|
||||
|
||||
unittest.AssertNotExistsBean(t, &user_model.User{Name: invalidUsername})
|
||||
|
||||
Reference in New Issue
Block a user