From 01e9d39350567968af8e7e7ce0370f417450981e Mon Sep 17 00:00:00 2001 From: David Dworken Date: Mon, 13 Feb 2023 20:24:20 -0800 Subject: [PATCH] Add TUI test for scrolling right by 2 --- client/client_test.go | 10 ++++++++- client/lib/goldens/TestTui-RightScrollTwo | 26 +++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 client/lib/goldens/TestTui-RightScrollTwo diff --git a/client/client_test.go b/client/client_test.go index 7d7cd4a..fa10fb9 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -1901,7 +1901,7 @@ func TestTui(t *testing.T) { out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1]) testutils.CompareGoldens(t, out, "TestTui-DeleteAgainStill") - // Test horizontal scrolling + // Test horizontal scrolling by one to the right testutils.Check(t, db.Create(testutils.MakeFakeHistoryEntry("echo '1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_1_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_2_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321'")).Error) out = captureTerminalOutput(t, tester, []string{ "hishtory SPACE tquery ENTER", @@ -1910,6 +1910,14 @@ func TestTui(t *testing.T) { out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1]) testutils.CompareGoldens(t, out, "TestTui-RightScroll") + // Test horizontal scrolling by two + out = captureTerminalOutput(t, tester, []string{ + "hishtory SPACE tquery ENTER", + "S-Right S-Right", + }) + out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1]) + testutils.CompareGoldens(t, out, "TestTui-RightScrollTwo") + // Assert there are no leaked connections assertNoLeakedConnections(t) } diff --git a/client/lib/goldens/TestTui-RightScrollTwo b/client/lib/goldens/TestTui-RightScrollTwo new file mode 100644 index 0000000..3538bb0 --- /dev/null +++ b/client/lib/goldens/TestTui-RightScrollTwo @@ -0,0 +1,26 @@ +Search Query: > ls + +┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hostname CWD Timestamp Runtime Exit Code Command │ +│────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ +│ localhost /tmp/ Oct 17 2022 21:43:31 PDT 3s 2 …tyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_1_1234567890qwertyuiopasdfghjklzxxcvbnm0… │ +│ localhost /tmp/ Oct 17 2022 21:43:16 PDT 3s 2 … │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ \ No newline at end of file