mirror of
https://github.com/ddworken/hishtory.git
synced 2025-03-31 19:37:34 +02:00
Add test for left scrolling in the input box
This commit is contained in:
parent
635b0575f9
commit
2edbf3977f
@ -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 {
|
||||
|
26
client/lib/goldens/TestTui-LeftScroll
Normal file
26
client/lib/goldens/TestTui-LeftScroll
Normal 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 ~/ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
Loading…
Reference in New Issue
Block a user