summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-04-10 20:11:47 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-04-10 20:17:12 +0900
commita4745626dd5c5f697dbbc5e3aa1796d5016c1faf (patch)
tree18cb90f4fc912dee09880414486fe07f0f34b46d /test
parent17bb7ad2784afdfc99beeec9e0a58f8dae12748a (diff)
Add jump and jump-cancel events
Close #3412 # Default behavior fzf --bind space:jump # Same as jump-accept action fzf --bind space:jump,jump:accept # Accept on jump, abort on cancel fzf --bind space:jump,jump:accept,jump-cancel:abort # Change header on jump-cancel fzf --bind 'space:change-header(Type jump label)+jump,jump-cancel:change-header:Jump cancelled'
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index dc4d646a..772d3cb7 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -1468,6 +1468,19 @@ class TestGoFZF < TestBase
assert_equal '3', readonce.chomp
end
+ def test_jump_events
+ tmux.send_keys "seq 1000 | #{fzf("--multi --jump-labels 12345 --bind 'ctrl-j:jump,jump:preview(echo jumped to {}),jump-cancel:preview(echo jump cancelled at {})'")}", :Enter
+ tmux.until { |lines| assert_equal ' 1000/1000 (0)', lines[-2] }
+ tmux.send_keys 'C-j'
+ tmux.until { |lines| assert_includes lines[-7], '5 5' }
+ tmux.send_keys '3'
+ tmux.until { |lines| assert(lines.any? { _1.include?('jumped to 3') }) }
+ tmux.send_keys 'C-j'
+ tmux.until { |lines| assert_includes lines[-7], '5 5' }
+ tmux.send_keys 'C-c'
+ tmux.until { |lines| assert(lines.any? { _1.include?('jump cancelled at 3') }) }
+ end
+
def test_pointer
tmux.send_keys "seq 10 | #{fzf("--pointer '>>'")}", :Enter
# Assert that specified pointer is displayed