Add test for horizontal scrolling other columns for #188

This commit is contained in:
David Dworken 2024-04-05 16:21:37 -07:00
parent 8ca3835cb0
commit 68b3311a07
No known key found for this signature in database
3 changed files with 74 additions and 1 deletions

View File

@ -1803,7 +1803,26 @@ func testTui_scroll(t *testing.T) {
out = stripTuiCommandPrefix(t, out) out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-RightScrollTwo") testutils.CompareGoldens(t, out, "TestTui-RightScrollTwo")
// TODO: Add a test here that shows all columns can be horizontally scrolled // Set up to test horizontal scrolling for other columns
veryLongDirEntry := testutils.MakeFakeHistoryEntry("echo 'short'")
veryLongDirEntry.CurrentWorkingDirectory = "/tmp/1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_1_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_2_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321"
manuallySubmitHistoryEntry(t, userSecret, veryLongDirEntry)
require.NoError(t, hctx.GetDb(hctx.MakeContext()).Create(veryLongDirEntry).Error)
// Test displaying long other columns
out = captureTerminalOutput(t, tester, []string{
"hishtory SPACE tquery ENTER",
})
out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-LongDirectoryName")
// Test horizontal scrolling for other columns
out = captureTerminalOutput(t, tester, []string{
"hishtory SPACE tquery ENTER",
"S-Right S-Right",
})
out = stripTuiCommandPrefix(t, out)
testutils.CompareGoldens(t, out, "TestTui-RightScrollDirectoryTwo")
// Assert there are no leaked connections // Assert there are no leaked connections
assertNoLeakedConnections(t) assertNoLeakedConnections(t)

View File

@ -0,0 +1,27 @@
Search Query: > ls
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ localhost /tmp/1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qw… Oct 17 2022 21:43:31 PDT 3s 2 echo 'short' │
│ localhost /tmp/ Oct 17 2022 21:43:26 PDT 3s 2 echo '1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qw… │
│ 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,27 @@
Search Query: > ls
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ localhost …yuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzx… Oct 17 2022 21:43:31 PDT 3s 2 … │
│ localhost … Oct 17 2022 21:43:26 PDT 3s 2 …tyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzx… │
│ localhost … Oct 17 2022 21:43:21 PDT 3s 2 … │
│ localhost … Oct 17 2022 21:43:16 PDT 3s 2 … │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
hiSHtory: Search your shell history • ctrl+h help