55 lines
929 B
Go
55 lines
929 B
Go
package htmlx_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"lishwist/assert"
|
|
"lishwist/http/props/htmlx"
|
|
)
|
|
|
|
type content struct {
|
|
Username htmlx.Input
|
|
Password htmlx.Input
|
|
RegisterLink htmlx.Link
|
|
Submit htmlx.Submit
|
|
}
|
|
|
|
func TestSnapshotForm(t *testing.T) {
|
|
form := htmlx.Form[content]{
|
|
Method: "POST",
|
|
Elements: content{
|
|
Username: htmlx.Input{
|
|
Label: "Username",
|
|
Name: "username",
|
|
Required: true,
|
|
},
|
|
Password: htmlx.Input{
|
|
Label: "Password",
|
|
Name: "password",
|
|
Type: "password",
|
|
Required: true,
|
|
},
|
|
RegisterLink: htmlx.Link{
|
|
Name: "Register",
|
|
Href: "/register",
|
|
},
|
|
Submit: htmlx.Submit{
|
|
Label: "Login",
|
|
},
|
|
},
|
|
}
|
|
|
|
assert.SnapshotXml(t, form)
|
|
assert.SnapshotJson(t, form)
|
|
}
|
|
|
|
func TestSnapshotLink(t *testing.T) {
|
|
link := htmlx.Link{
|
|
Name: "Register",
|
|
Href: "/register",
|
|
}
|
|
|
|
assert.SnapshotXml(t, link)
|
|
assert.SnapshotJson(t, link)
|
|
}
|