Skip to content

Commit c4928a2

Browse files
committed
fixup! Add tests for window arrangement code
1 parent 1df9348 commit c4928a2

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

pkg/gui/controllers/helpers/window_arrangement_helper_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,48 @@ func TestGetWindowDimensions(t *testing.T) {
179179
<appStatus────────────────────────────────────────────────────────────────>
180180
`,
181181
},
182+
{
183+
name: "app status present with information but without options",
184+
mutateArgs: func(args *WindowArrangementArgs) {
185+
args.Height = 6 // small height cos we only care about the bottom line
186+
args.UserConfig.Gui.ShowBottomLine = false // this hides the options window
187+
args.IsAnyModeActive = true
188+
args.AppStatus = "Rebasing /"
189+
},
190+
expected: `
191+
<status─────────────────>╭main────────────────────────────────────────────╮
192+
<files──────────────────>│ │
193+
<branches───────────────>│ │
194+
<commits────────────────>│ │
195+
<stash──────────────────>╰────────────────────────────────────────────────╯
196+
<A───────><statusSpacer1──────────────────────────────────────>B<C────────>
197+
A: appStatus
198+
B: statusSpacer2
199+
C: information
200+
`,
201+
},
202+
{
203+
name: "app status present with very long information but without options",
204+
mutateArgs: func(args *WindowArrangementArgs) {
205+
args.Height = 6 // small height cos we only care about the bottom line
206+
args.Width = 55 // smaller width so that not all bottom line views fit
207+
args.UserConfig.Gui.ShowBottomLine = false // this hides the options window
208+
args.IsAnyModeActive = true
209+
args.AppStatus = "Rebasing /"
210+
args.InformationStr = "Showing output for: git diff deadbeef fa1afe1 -- (Reset)"
211+
},
212+
expected: `
213+
<status───────────>╭main──────────────────────────────╮
214+
<files────────────>│ │
215+
<branches─────────>│ │
216+
<commits──────────>│ │
217+
<stash────────────>╰──────────────────────────────────╯
218+
<A───────>C<information──────────────────────────────────────────>
219+
A: appStatus
220+
B: statusSpacer1
221+
C: statusSpacer2
222+
`,
223+
},
182224
}
183225

184226
for _, test := range tests {

0 commit comments

Comments
 (0)