Skip to content

Commit

Permalink
update button_internal_test
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Jan 24, 2024
1 parent 45bca5d commit f8d1e90
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions widget/button_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func TestButton_DisabledIconChangeUsingSetIcon(t *testing.T) {

// assert we are using the disabled original icon
button.Disable()
assert.True(t, strings.HasPrefix(render.icon.Resource.Name(), "disabled_"))
cancelBaseName := strings.TrimPrefix(theme.CancelIcon().Name(), "foreground_")
assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", cancelBaseName))

// re-enable, then change the icon
button.Enable()
Expand All @@ -101,7 +102,9 @@ func TestButton_DisabledIconChangeUsingSetIcon(t *testing.T) {

// assert we are using the disabled new icon
button.Disable()
assert.True(t, strings.HasPrefix(render.icon.Resource.Name(), "disabled_"))
searchBaseName := strings.TrimPrefix(theme.SearchIcon().Name(), "foreground_")
assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", searchBaseName))

}

func TestButton_DisabledIconChangedDirectly(t *testing.T) {
Expand All @@ -111,7 +114,8 @@ func TestButton_DisabledIconChangedDirectly(t *testing.T) {

// assert we are using the disabled original icon
button.Disable()
assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", theme.CancelIcon().Name()))
cancelBaseName := strings.TrimPrefix(theme.CancelIcon().Name(), "foreground_")
assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", cancelBaseName))

// re-enable, then change the icon
button.Enable()
Expand All @@ -121,7 +125,8 @@ func TestButton_DisabledIconChangedDirectly(t *testing.T) {

// assert we are using the disabled new icon
button.Disable()
assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", theme.SearchIcon().Name()))
searchBaseName := strings.TrimPrefix(theme.SearchIcon().Name(), "foreground_")
assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", searchBaseName))

}

Expand Down

0 comments on commit f8d1e90

Please sign in to comment.