From 4d00f31c72042d25a437a227878a2700f784afe4 Mon Sep 17 00:00:00 2001 From: osxtest <38131934+osxtest@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:54:39 +0800 Subject: [PATCH] Add text input maxlength test --- fill_test.go | 5 +++++ forms/big-empty.html | 2 ++ 2 files changed, 7 insertions(+) diff --git a/fill_test.go b/fill_test.go index 87731da..4170e9b 100644 --- a/fill_test.go +++ b/fill_test.go @@ -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"}, @@ -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}, @@ -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) { diff --git a/forms/big-empty.html b/forms/big-empty.html index cbde5f8..83d26dc 100644 --- a/forms/big-empty.html +++ b/forms/big-empty.html @@ -27,6 +27,8 @@ + +