summaryrefslogtreecommitdiff
path: root/test/acceptance
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2017-01-13 20:52:55 -0800
committerJohn Hawthorn <john.hawthorn@gmail.com>2017-01-13 20:54:42 -0800
commit8301d16cb20611501ef57afd95dd46e96bde2552 (patch)
treeb3640e2df4967e429c5746996ec1692dd05f7346 /test/acceptance
parent5df8c7c5078a6c7faf927c2c5308c93c1f660e22 (diff)
Add tests for arrow keys
Diffstat (limited to 'test/acceptance')
-rw-r--r--test/acceptance/acceptance_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/acceptance/acceptance_test.rb b/test/acceptance/acceptance_test.rb
index aed795d..67a0ccf 100644
--- a/test/acceptance/acceptance_test.rb
+++ b/test/acceptance/acceptance_test.rb
@@ -174,4 +174,30 @@ class FzyTest < Minitest::Test
@tty.assert_matches ''
@tty.assert_cursor_position(y: 0, x: 0)
end
+
+ def test_down_arrow
+ @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH}})
+ @tty.assert_matches ">\nfoo\nbar"
+ @tty.send_keys("\e[A\r")
+ @tty.assert_matches "bar"
+
+ @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH}})
+ @tty.assert_matches ">\nfoo\nbar"
+ @tty.send_keys("\eOA\r")
+ @tty.assert_matches "bar"
+ end
+
+ def test_up_arrow
+ @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH}})
+ @tty.assert_matches ">\nfoo\nbar"
+ @tty.send_keys("\e[A") # first down
+ @tty.send_keys("\e[B\r") # and back up
+ @tty.assert_matches "foo"
+
+ @tty = TTYtest.new_terminal(%{echo -n "foo\nbar" | #{FZY_PATH}})
+ @tty.assert_matches ">\nfoo\nbar"
+ @tty.send_keys("\eOA") # first down
+ @tty.send_keys("\e[B\r") # and back up
+ @tty.assert_matches "foo"
+ end
end