-
Notifications
You must be signed in to change notification settings - Fork 1
/
selectinput_test.go
56 lines (47 loc) · 1.57 KB
/
selectinput_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
54
55
56
package goey
import (
"bitbucket.org/rj/goey/base"
"testing"
)
func TestSelectInputMount(t *testing.T) {
options := []string{"Option A", "Option B", "Option C"}
testingMountWidgets(t,
&SelectInput{Value: 0, Items: options},
&SelectInput{Value: 1, Items: options},
&SelectInput{Value: 2, Items: options, Disabled: true},
&SelectInput{Unset: true, Items: options, Disabled: true},
&SelectInput{Items: []string{}},
)
}
func TestSelectInputClose(t *testing.T) {
options := []string{"Option A", "Option B", "Option C"}
testingCloseWidgets(t,
&SelectInput{Value: 0, Items: options},
&SelectInput{Value: 1, Items: options},
&SelectInput{Value: 2, Items: options, Disabled: true},
&SelectInput{Unset: true, Items: options, Disabled: true},
)
}
func TestSelectInputEvents(t *testing.T) {
options := []string{"Option A", "Option B", "Option C"}
testingCheckFocusAndBlur(t,
&SelectInput{Items: options},
&SelectInput{Items: options},
&SelectInput{Items: options},
)
}
func TestSelectInputUpdateProps(t *testing.T) {
options1 := []string{"Option A", "Option B", "Option C"}
options2 := []string{"Choice A", "Choice B", "Choice C"}
testingUpdateWidgets(t, []base.Widget{
&SelectInput{Value: 0, Items: options1},
&SelectInput{Value: 1, Items: options2},
&SelectInput{Value: 2, Items: options1, Disabled: true},
&SelectInput{Unset: true, Items: options2},
}, []base.Widget{
&SelectInput{Value: 1, Items: options2},
&SelectInput{Unset: true, Items: options1},
&SelectInput{Value: 2, Items: options1, Disabled: true},
&SelectInput{Value: 1, Items: options2},
})
}