-
Notifications
You must be signed in to change notification settings - Fork 0
/
classnames_test.go
45 lines (38 loc) · 996 Bytes
/
classnames_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package smetana
import "testing"
func TestClassNamesConcatsStringsAndClassNames(t *testing.T) {
result := ClassNames("foo", "bar", ClassName("baz"))
assertEqual(t, "foo bar baz", result)
}
func TestClassNamesIgnoresEmptyStrings(t *testing.T) {
result := ClassNames("foo", "", "bar", "")
assertEqual(t, "foo bar", result)
}
func TestClassNamesCanbeEmpty(t *testing.T) {
result := ClassNames()
assertEqual(t, "", result)
}
func TestClassesNamesCanBeConditional(t *testing.T) {
one := 1
result := ClassNames(Classes{
"a": true,
"b": false,
"c": 1 == 2,
"d": 1 == one,
})
assertOneOf(t, []ClassName{"a d", "d a"}, result)
}
func TestCanMixConditionalAndUnconditionalClasses(t *testing.T) {
result := ClassNames("foo", Classes{
"a": true,
"b": false,
}, "bar", Classes{
"e": false,
"f": true,
})
assertEqual(t, "foo a bar f", result)
}
func TestClassNamesIgnoresInvalidArgumentTypes(t *testing.T) {
result := ClassNames("foo", 3)
assertEqual(t, "foo", result)
}