fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit 31e09a021c225a8de52efa8b004e63ab03e904da parent 50493875cfb932917f3d817358abe9f275861770 Author: John Hawthorn <john.hawthorn@gmail.com> Date: Fri, 13 Jan 2017 20:52:55 -0800 Add tests for arrow keys Diffstat:
| M | test/acceptance/acceptance_test.rb | | | 26 | ++++++++++++++++++++++++++ |
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git 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