summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-26 01:50:08 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-26 01:50:08 +0900
commit7220d8233e81291db8bda3d4eb5286ca45f07be0 (patch)
tree0bbb9c4593e50c0a06408982c0b907c30db8661b /test
parent0237bf09bf1fe70d94727b040ac39110f56b497f (diff)
downloadfzf-7220d8233e81291db8bda3d4eb5286ca45f07be0.tar.gz
Add 'search' and 'transform-search'
Close #4202
Diffstat (limited to 'test')
-rw-r--r--test/test_core.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_core.rb b/test/test_core.rb
index 1524a885..0d80644b 100644
--- a/test/test_core.rb
+++ b/test/test_core.rb
@@ -1069,6 +1069,24 @@ class TestCore < TestInteractive
tmux.until { |lines| assert_equal 'up', lines[-1] }
end
+ def test_search
+ tmux.send_keys %(seq 100 | #{FZF} --query 0 --bind space:search:1), :Enter
+ tmux.until { |lines| assert_equal 10, lines.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert_equal 20, lines.match_count }
+ tmux.send_keys '0'
+ tmux.until { |lines| assert_equal 1, lines.match_count }
+ end
+
+ def test_transform_search
+ tmux.send_keys %(seq 1000 | #{FZF} --bind 'change:transform-search:echo {q}{q}'), :Enter
+ tmux.until { |lines| assert_equal 1000, lines.match_count }
+ tmux.send_keys '1'
+ tmux.until { |lines| assert_equal 28, lines.match_count }
+ tmux.send_keys :BSpace, '0'
+ tmux.until { |lines| assert_equal 10, lines.match_count }
+ end
+
def test_clear_selection
tmux.send_keys %(seq 100 | #{FZF} --multi --bind space:clear-selection), :Enter
tmux.until { |lines| assert_equal 100, lines.match_count }