Skip to content

Commit

Permalink
Added test for selecting new last tab after removal of last tab
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianre12 committed Dec 21, 2020
1 parent 06b84ab commit f604038
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion widget/tabcontainer_test.go
Expand Up @@ -100,7 +100,12 @@ func TestTabContainer_SelectTabIndex(t *testing.T) {
}

func TestTabContainer_RemoveIndex(t *testing.T) {
tabs := widget.NewTabContainer(&widget.TabItem{Text: "Test1", Content: widget.NewLabel("Test1")})
tabs := widget.NewTabContainer(&widget.TabItem{Text: "Test1", Content: widget.NewLabel("Test1")},
&widget.TabItem{Text: "Test2", Content: widget.NewLabel("Test2")})

tabs.SelectTabIndex(1)
tabs.RemoveIndex(1)
assert.Equal(t, 0, tabs.CurrentTabIndex()) // check max item selection and no panic

tabs.SelectTabIndex(0)
tabs.RemoveIndex(0)
Expand Down

0 comments on commit f604038

Please sign in to comment.