-
Notifications
You must be signed in to change notification settings - Fork 1
/
tabs_test.go
51 lines (43 loc) · 1.01 KB
/
tabs_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
package goey
import (
"testing"
"bitbucket.org/rj/goey/base"
)
func TestTabsMount(t *testing.T) {
items := []TabItem{
{"Tab 1", &Button{Text: "Click me A!"}},
{"Tab 2", &Button{Text: "Click me B!"}},
}
testingMountWidgets(t,
&Tabs{Children: items},
&Tabs{Value: 1, Children: items},
)
}
func TestTabsClose(t *testing.T) {
items := []TabItem{
{"Tab 1", &Button{Text: "Click me A!"}},
{"Tab 2", &Button{Text: "Click me B!"}},
}
testingCloseWidgets(t,
&Tabs{Children: items},
&Tabs{Value: 1, Children: items},
)
}
func TestTabsUpdate(t *testing.T) {
items1 := []TabItem{
{"Tab 1", &Button{Text: "Click me!"}},
{"Tab 2", &Button{Text: "Don't click me!"}},
}
items2 := []TabItem{
{"Tab A", &Button{Text: "Don't click me!"}},
{"Tab B", &Button{Text: "Click me!"}},
{"Tab C", &Button{Text: "..."}},
}
testingUpdateWidgets(t, []base.Widget{
&Tabs{Children: items1},
&Tabs{Value: 1, Children: items2},
}, []base.Widget{
&Tabs{Value: 1, Children: items2},
&Tabs{Children: items1},
})
}