mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 11:10:57 +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) {
|
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">` {
|
if html != `Label: <input name="Name" type="text" value="Value">` {
|
||||||
t.Errorf("Wrong html output for input[type=text]: %v ", html)
|
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>` {
|
if html != `Label: <textarea name="Name">Value</textarea>` {
|
||||||
t.Errorf("Wrong html output for textarea: %v ", html)
|
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) {
|
func TestParseFormTag(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user