mirror of
https://github.com/astaxie/beego.git
synced 2024-11-01 01:20:56 +00:00
Add test function
This commit is contained in:
parent
f9f92b4f61
commit
21c7821692
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user