summaryrefslogtreecommitdiff
path: root/test/test_preview.rb
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-02-18 10:08:47 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-02-18 10:08:47 +0900
commitf975b402365d92c816a060aba580811bc5c55cc5 (patch)
treef1353f787184c3c23ecfe295ea11713fe277a940 /test/test_preview.rb
parent01d9d9c8c895de728e7abcad1723db019280452d (diff)
downloadfzf-f975b402365d92c816a060aba580811bc5c55cc5.tar.gz
Fix {q} in preview window affected by 'search' action
Diffstat (limited to 'test/test_preview.rb')
-rw-r--r--test/test_preview.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_preview.rb b/test/test_preview.rb
index 11b3225d..576e36ec 100644
--- a/test/test_preview.rb
+++ b/test/test_preview.rb
@@ -544,4 +544,18 @@ class TestPreview < TestInteractive
tmux.send_keys :Up
tmux.until { |lines| assert_includes lines, '> 2' }
end
+
+ def test_preview_query_should_not_be_affected_by_search
+ tmux.send_keys "seq 1 | #{FZF} --bind 'change:transform-search(echo {q:1})' --preview 'echo [{q}/{}]'", :Enter
+ tmux.until { |lines| assert_equal 1, lines.match_count }
+ tmux.send_keys '1'
+ tmux.until { |lines| assert lines.any_include?('[1/1]') }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert lines.any_include?('[1 /1]') }
+ tmux.send_keys '2'
+ tmux.until do |lines|
+ assert lines.any_include?('[1 2/1]')
+ assert_equal 1, lines.match_count
+ end
+ end
end