Add tests for tiny terminals + update test goldens for tiny terminals after compact sizing

This commit is contained in:
David Dworken
2023-12-03 16:51:05 -08:00
parent 10aa0bc7b4
commit ea911cb07e
5 changed files with 43 additions and 0 deletions

View File

@@ -1639,6 +1639,21 @@ func testTui_resize(t *testing.T) {
out = stripTuiCommandPrefix(t, out) out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-SmallTerminal") testutils.CompareGoldens(t, out, "TestTui-SmallTerminal")
// Check the output when the size is tiny
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 15, []TmuxCommand{
{Keys: "hishtory SPACE tquery ENTER"},
})
out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-TinyTerminal")
// Check the output when the size is tiny and the help page is open
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 15, []TmuxCommand{
{Keys: "hishtory SPACE tquery ENTER"},
{Keys: "C-h"},
})
out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-TinyTerminalHelp")
// Check that it resizes after the terminal size is adjusted // Check that it resizes after the terminal size is adjusted
manuallySubmitHistoryEntry(t, userSecret, testutils.MakeFakeHistoryEntry("echo 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'")) manuallySubmitHistoryEntry(t, userSecret, testutils.MakeFakeHistoryEntry("echo 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'"))
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 20, []TmuxCommand{ out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 20, []TmuxCommand{

View File

@@ -11,5 +11,7 @@ Search Query: > 1234567890qwertyuip1234567890qwertyuip1234567890qwertyuip1234567
│ │ │ │
│ │ │ │
│ │ │ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘ └──────────────────────────────────────────────────────────────────────────────────────────────────┘
hiSHtory: Search your shell history • ctrl+h help hiSHtory: Search your shell history • ctrl+h help

View File

@@ -11,5 +11,7 @@ Search Query: > ls
│ │ │ │
│ │ │ │
│ │ │ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────┘ └────────────────────────────────────────────────────────────────────────────────────────────┘
hiSHtory: Search your shell history • ctrl+h help hiSHtory: Search your shell history • ctrl+h help

View File

@@ -0,0 +1,12 @@
Search Query: > ls
┌────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│────────────────────────────────────────────────────────────────────────────────────────────│
│ 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 ~/ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────┘
hiSHtory: Search your shell history • ctrl+h help

View File

@@ -0,0 +1,12 @@
Search Query: > ls
┌────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│────────────────────────────────────────────────────────────────────────────────────────────│
│ 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 ~/ │
hiSHtory: Search your shell history
↑ scroll up
← move left
enter select an entry
ctrl+x select an entry and cd into that directory