@@ -8,10 +8,16 @@ import (
88 "github.com/stretchr/testify/assert"
99)
1010
11+ // newTestShell builds a shell over an addressable test theme.
12+ func newTestShell (breadcrumb string ) Shell {
13+ theme := NewTheme (true )
14+ return NewShell (& theme , breadcrumb )
15+ }
16+
1117func TestNewShell (t * testing.T ) {
1218 t .Parallel ()
1319
14- shell := NewShell ( NewTheme ( true ), "Search > Results" )
20+ shell := newTestShell ( "Search > Results" )
1521
1622 assert .Equal (t , defaultShellWidth , shell .Width )
1723 assert .Equal (t , defaultShellHeight , shell .Height )
@@ -34,7 +40,7 @@ func TestShellResize(t *testing.T) {
3440 for _ , tt := range tests {
3541 t .Run (tt .name , func (t * testing.T ) {
3642 t .Parallel ()
37- shell := NewShell ( NewTheme ( true ), "" )
43+ shell := newTestShell ( "" )
3844 shell .Resize (tt .width , tt .height )
3945 assert .Equal (t , tt .wantWidth , shell .Width )
4046 assert .Equal (t , tt .wantHeight , shell .Height )
@@ -121,7 +127,7 @@ func TestShellRender(t *testing.T) {
121127 for _ , tt := range tests {
122128 t .Run (tt .name , func (t * testing.T ) {
123129 t .Parallel ()
124- shell := NewShell ( NewTheme ( true ), "Search > Results" )
130+ shell := newTestShell ( "Search > Results" )
125131 shell .Resize (tt .width , 24 )
126132
127133 got := shell .Render ("BODY" , "↑↓ navigate / filter" )
@@ -141,7 +147,7 @@ func TestShellRender(t *testing.T) {
141147 width int
142148 height int
143149 }{{1 , 5 }, {8 , 5 }, {20 , 6 }, {33 , 8 }, {80 , 12 }} {
144- shell := NewShell ( NewTheme ( true ), strings .Repeat ("long breadcrumb " , 20 ))
150+ shell := newTestShell ( strings .Repeat ("long breadcrumb " , 20 ))
145151 shell .Resize (size .width , size .height )
146152 body := strings .Repeat ("very long body " , 20 ) + "\n " + strings .Repeat ("extra line\n " , 20 )
147153
0 commit comments