Skip to content

Commit

Permalink
Add text input maxlength test
Browse files Browse the repository at this point in the history
  • Loading branch information
osxtest committed Nov 20, 2024
1 parent cce98cf commit 4d00f31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func TestAutoFill(t *testing.T) {
}

randomLastName := r.FormValue("lastName")
randomCaptcha := r.FormValue("captcha")

expectedForm := url.Values{
"sel2": []string{"4", "5", "6"},
Expand All @@ -247,6 +248,7 @@ func TestAutoFill(t *testing.T) {
"email": []string{AutoFillEmail},
"firstName": []string{"John"},
"age": []string{"18"},
"captcha": []string{randomCaptcha},
"lastName": []string{randomLastName},
"someDate": []string{AutoFillDate},
"website": []string{AutoFillURL},
Expand All @@ -272,6 +274,9 @@ func TestAutoFill(t *testing.T) {
if !bytes.Equal(AutoFillFile, fileData) {
t.Errorf("Picture contents do not match: %s vs %s", AutoFillFile, fileData)
}
if len(randomCaptcha) != 5 {
t.Errorf("Expected captcha to be 5 characters long, but was %d", len(randomCaptcha))
}
}

func TestMultipartParams_invalid(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions forms/big-empty.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

<input type="number" name="age" min="18" max="99" required>

<input type="text" name="captcha" maxlength="5" required>

<input type="url" name="website" required>
<input type="date" name="someDate" required>

Expand Down

0 comments on commit 4d00f31

Please sign in to comment.