Add test for forced compact mode (from #237)

This commit is contained in:
David Dworken 2024-08-11 11:55:08 -07:00
parent 30a7dcb3c7
commit 0c9a369c54
No known key found for this signature in database
2 changed files with 37 additions and 0 deletions

View File

@ -1778,6 +1778,18 @@ func testTui_resize(t *testing.T) {
})
out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-LongQuery")
// Toggle on forced compact mode and check that it respects that even with a large terminal
require.Equal(t, "false", strings.TrimSpace(tester.RunInteractiveShell(t, `hishtory config-get compact-mode`)))
tester.RunInteractiveShell(t, `hishtory config-set compact-mode true`)
require.Equal(t, "true", strings.TrimSpace(tester.RunInteractiveShell(t, `hishtory config-get compact-mode`)))
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 150, 60, []TmuxCommand{
{Keys: "hishtory SPACE tquery ENTER"},
})
out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-ForcedCompactMode")
tester.RunInteractiveShell(t, `hishtory config-set compact-mode false`)
require.Equal(t, "false", strings.TrimSpace(tester.RunInteractiveShell(t, `hishtory config-get compact-mode`)))
}
func testTui_scroll(t *testing.T) {

View File

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