From c36a64be6823da402419ad42e18edf42ac2bc908 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 10 Dec 2023 15:59:45 +0900 Subject: Add accept-or-print-query Close #3528 --- test/test_go.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb index 30d5e7b2..b69f9d95 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1776,6 +1776,35 @@ class TestGoFZF < TestBase assert_equal %w[foo], readonce.lines(chomp: true) end + def test_accept_or_print_query_without_match + tmux.send_keys %(seq 1000 | #{fzf('--bind enter:accept-or-print-query')}), :Enter + tmux.until { |lines| assert_equal 1000, lines.match_count } + tmux.send_keys 99999 + tmux.until { |lines| assert_equal 0, lines.match_count } + tmux.send_keys :Enter + assert_equal %w[99999], readonce.lines(chomp: true) + end + + def test_accept_or_print_query_with_match + tmux.send_keys %(seq 1000 | #{fzf('--bind enter:accept-or-print-query')}), :Enter + tmux.until { |lines| assert_equal 1000, lines.match_count } + tmux.send_keys '^99$' + tmux.until { |lines| assert_equal 1, lines.match_count } + tmux.send_keys :Enter + assert_equal %w[99], readonce.lines(chomp: true) + end + + def test_accept_or_print_query_with_multi_selection + tmux.send_keys %(seq 1000 | #{fzf('--bind enter:accept-or-print-query --multi')}), :Enter + tmux.until { |lines| assert_equal 1000, lines.match_count } + tmux.send_keys :BTab, :BTab, :BTab + tmux.until { |lines| assert_equal 3, lines.select_count } + tmux.send_keys 99999 + tmux.until { |lines| assert_equal 0, lines.match_count } + tmux.send_keys :Enter + assert_equal %w[1 2 3], readonce.lines(chomp: true) + end + def test_preview_update_on_select tmux.send_keys %(seq 10 | fzf -m --preview 'echo {+}' --bind a:toggle-all), :Enter -- cgit v1.2.3