This commit is contained in:
@@ -371,11 +371,19 @@ func TestEmptyOptionalSpeciesDimensionsDoNotBlockSubmit(t *testing.T) {
|
||||
response := httptest.NewRecorder()
|
||||
app.render(response, http.StatusOK, "species_form.tmpl", data)
|
||||
body := response.Body.String()
|
||||
for _, field := range []string{"spacing_cm", "height_cm"} {
|
||||
if !strings.Contains(body, "name='"+field+"' value=''") {
|
||||
for _, field := range []string{"spacing_cm", "height_cm_from", "height_cm_to", "width_cm_from", "width_cm_to"} {
|
||||
fieldStart := strings.Index(body, "name='"+field+"'")
|
||||
fieldEnd := -1
|
||||
if fieldStart >= 0 {
|
||||
fieldEnd = strings.Index(body[fieldStart:], ">")
|
||||
}
|
||||
if fieldStart < 0 || fieldEnd < 0 || !strings.Contains(body[fieldStart:fieldStart+fieldEnd], "value=''") {
|
||||
t.Errorf("optional field %s should render empty: %s", field, body)
|
||||
}
|
||||
}
|
||||
if got := strings.Count(body, "class='dimension-range'"); got != 2 {
|
||||
t.Errorf("dimension ranges: got %d composite controls, want 2: %s", got, body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTaskDueFormatsWindows(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user