Skip to content

Commit

Permalink
Add missing focus test
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 24, 2025
1 parent 155b6db commit 747fc68
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions container/apptabs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ func TestAppTabs_Select(t *testing.T) {
assert.Equal(t, tab2, tabs.Selected())
}

func TestAppTabs_SelectFocus(t *testing.T) {
tab1 := &TabItem{Text: "Test1", Content: widget.NewEntry()}
tab2 := &TabItem{Text: "Test2", Content: widget.NewEntry()}
tabs := NewAppTabs(tab1, tab2)
w := test.NewTempWindow(t, tabs)

tabs.OnSelected = func(t *TabItem) {
w.Canvas().Focus(t.Content.(*widget.Entry))
}

tabs.Select(tab2)
assert.Equal(t, tab2.Content, w.Canvas().Focused())
}

func TestAppTabs_SelectIndex(t *testing.T) {
tabs := NewAppTabs(&TabItem{Text: "Test1", Content: widget.NewLabel("Test1")},
&TabItem{Text: "Test2", Content: widget.NewLabel("Test2")})
Expand Down

0 comments on commit 747fc68

Please sign in to comment.