summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-06-21 17:21:03 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-06-21 17:28:48 +0900
commitc36ddce36fce8e2e11a822366df81c5c15644a14 (patch)
tree32e6092a12ce16ec88847b93a5631bd40ccffd13 /test
parentc35d9cff7d26dc0389db888c461c660147613f7d (diff)
downloadfzf-c36ddce36fce8e2e11a822366df81c5c15644a14.tar.gz
Add bg-cancel action to ignore running background transforms
Close #4430 Example: # Implement popup that disappears after 1 second # * Use footer as the popup # * Use `bell` to ring the terminal bell # * Use `bg-transform-footer` to clear the footer after 1 second # * Use `bg-cancel` to ignore currently running background transform actions fzf --multi --list-border \ --bind 'enter:execute-silent(echo -n {+} | pbcopy)+bell' \ --bind 'enter:+transform-footer(echo Copied {} to clipboard)' \ --bind 'enter:+bg-cancel+bg-transform-footer(sleep 1)'
Diffstat (limited to 'test')
-rw-r--r--test/test_core.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_core.rb b/test/test_core.rb
index f714e1c3..b7eba741 100644
--- a/test/test_core.rb
+++ b/test/test_core.rb
@@ -1964,4 +1964,21 @@ class TestCore < TestInteractive
elapsed = Time.now - time
assert elapsed < 2
end
+
+ def test_bg_cancel
+ tmux.send_keys %(seq 0 1 | #{FZF} --bind 'space:bg-cancel+bg-transform-header(sleep {}; echo [{}])'), :Enter
+ tmux.until { assert_equal 2, it.match_count }
+ tmux.send_keys '1'
+ tmux.until { assert_equal 1, it.match_count }
+ tmux.send_keys :Space
+ tmux.send_keys :BSpace
+ tmux.until { assert_equal 2, it.match_count }
+ tmux.send_keys :Space
+ tmux.until { |lines| assert lines.any_include?('[0]') }
+ sleep 2
+ tmux.until do |lines|
+ assert lines.any_include?('[0]')
+ refute lines.any_include?('[1]')
+ end
+ end
end