Add test for left scrolling in the input box

This commit is contained in:
David Dworken 2022-12-17 12:14:28 -08:00
parent 635b0575f9
commit 2edbf3977f
No known key found for this signature in database
2 changed files with 37 additions and 1 deletions

View File

@ -1868,12 +1868,22 @@ func TestTui(t *testing.T) {
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
compareGoldens(t, out, "TestTui-InvalidSearch")
// Check the output when the size is adjusted
// Check the output when the size is smaller
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 20, []string{
"hishtory SPACE tquery ENTER",
})
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
compareGoldens(t, out, "TestTui-SmallTerminal")
// Check that we can use left arrow keys to scroll
out = captureTerminalOutput(t, tester, []string{
"hishtory SPACE tquery ENTER",
"s",
"Left",
"l",
})
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
compareGoldens(t, out, "TestTui-LeftScroll")
}
func captureTerminalOutput(t *testing.T, tester shellTester, commands []string) string {

View File

@ -0,0 +1,26 @@
Search Query: > ls
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ localhost /tmp/ Oct 17 2022 21:43:16 PDT 3s 2 ls ~/ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘