1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 11:10:50 +00:00

Add test function

This commit is contained in:
Joshua Santos 2016-06-28 16:24:32 -07:00
parent f9f92b4f61
commit 21c7821692

View File

@ -195,15 +195,20 @@ func TestRenderForm(t *testing.T) {
}
func TestRenderFormField(t *testing.T) {
html := renderFormField("Label: ", "Name", "text", "Value", "", "")
html := renderFormField("Label: ", "Name", "text", "Value", "", "", false)
if html != `Label: <input name="Name" type="text" value="Value">` {
t.Errorf("Wrong html output for input[type=text]: %v ", html)
}
html = renderFormField("Label: ", "Name", "textarea", "Value", "", "")
html = renderFormField("Label: ", "Name", "textarea", "Value", "", "", false)
if html != `Label: <textarea name="Name">Value</textarea>` {
t.Errorf("Wrong html output for textarea: %v ", html)
}
html = renderFormField("Label: ", "Name", "textarea", "Value", "", "", true)
if html != `Label: <textarea name="Name" required>Value</textarea>` {
t.Errorf("Wrong html output for textarea: %v ", html)
}
}
func TestParseFormTag(t *testing.T) {