summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-12-10 15:59:45 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-12-10 15:59:45 +0900
commitc36a64be6823da402419ad42e18edf42ac2bc908 (patch)
tree66e67227c662f6aef912f381ebe115ea511936a0 /test
parenta343b20775ea4f0d8882ef4ea8157d6bf70f8022 (diff)
Add accept-or-print-query
Close #3528
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb29
1 files changed, 29 insertions, 0 deletions
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