-
-
Notifications
You must be signed in to change notification settings - Fork 144
/
Copy pathStyleSetter_test.go
53 lines (49 loc) · 1.52 KB
/
StyleSetter_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
46
47
48
49
50
51
52
53
package giu
import (
"testing"
"github.com/stretchr/testify/assert"
"golang.org/x/image/colornames"
)
func TestStyleSetter_Add(t *testing.T) {
cases := []struct {
name string
setter *StyleSetter
other *StyleSetter
expected *StyleSetter
}{
{
name: "Adding nil",
setter: Style().SetColor(StyleColorText, colornames.Red).
SetStyle(StyleVarWindowPadding, 10, 10),
other: nil,
expected: Style().SetColor(StyleColorText, colornames.Red).
SetStyle(StyleVarWindowPadding, 10, 10),
},
{
name: "Adding some styles/colors",
setter: Style().SetColor(StyleColorText, colornames.Red).
SetStyle(StyleVarWindowPadding, 10, 10),
other: Style().SetColor(StyleColorWindowBg, colornames.Red).
SetStyle(StyleVarFramePadding, 10, 10),
expected: Style().SetColor(StyleColorText, colornames.Red).
SetStyle(StyleVarWindowPadding, 10, 10).
SetColor(StyleColorWindowBg, colornames.Red).
SetStyle(StyleVarFramePadding, 10, 10),
},
{
name: "Overwrite",
setter: Style().SetColor(StyleColorText, colornames.Red).
SetStyle(StyleVarWindowPadding, 10, 10),
other: Style().SetColor(StyleColorText, colornames.Blue).
SetStyle(StyleVarWindowPadding, 11, 11),
expected: Style().SetColor(StyleColorText, colornames.Blue).
SetStyle(StyleVarWindowPadding, 11, 11),
},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
c.setter.Add(c.other)
assert.True(t, assert.ObjectsAreEqual(c.setter, c.expected), "Expected: %v, got: %v", c.expected, c.setter)
})
}
}