-
Notifications
You must be signed in to change notification settings - Fork 0
/
radio_test.go
31 lines (24 loc) · 941 Bytes
/
radio_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package html
import (
"strings"
"testing"
)
func TestRadioRender(t *testing.T) {
expected1 := "<div class=\"test\">"
expected2 := "<input type=\"radio\" id=\"test\" name=\"test\" value=\"test\" checked>"
expected3 := "<label for=\"test\">Test</label>"
expected4 := "</div>"
r := Radio().Label("Test").ID("test").Class("test").Value("test").Name("test").Check()
if !strings.Contains(r.Render(), expected1) {
t.Errorf("HTML output (%s) does not contain expected output: %s", r.Render(), expected1)
}
if !strings.Contains(r.Render(), expected2) {
t.Errorf("HTML output (%s) does not contain expected output: %s", r.Render(), expected2)
}
if !strings.Contains(r.Render(), expected3) {
t.Errorf("HTML output (%s) does not contain expected output: %s", r.Render(), expected3)
}
if !strings.Contains(r.Render(), expected4) {
t.Errorf("HTML output (%s) does not contain expected output: %s", r.Render(), expected4)
}
}