diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2025-06-16 00:39:11 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-16 00:39:11 +0900 |
| commit | 0c00b203e61bffbadbc499cbf68af6f89a5a3e29 (patch) | |
| tree | effd2636b35640cede4f2e8e362f18ee91836a5b /test | |
| parent | 3b68dcdd81394f1ac9f743e1f74ff754f95eef9e (diff) | |
| download | fzf-0c00b203e61bffbadbc499cbf68af6f89a5a3e29.tar.gz | |
Implement asynchronous transform actions (#4419)
Close #4418
Example:
fzf --bind 'focus:bg-transform-header(sleep 2; date; echo {})'
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_core.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_core.rb b/test/test_core.rb index 94ed9251..f714e1c3 100644 --- a/test/test_core.rb +++ b/test/test_core.rb @@ -1939,4 +1939,29 @@ class TestCore < TestInteractive tmux.send_keys %(echo -en "foo\n" | fzf --read0 --no-multi-line), :Enter tmux.until { |lines| assert_includes lines, '> foo␊' } end + + def test_async_transform + time = Time.now + tmux.send_keys %( + seq 100 | #{FZF} --style full --border --preview : \ + --bind 'focus:bg-transform-header(sleep 0.5; echo th.)' \ + --bind 'focus:+bg-transform-footer(sleep 0.5; echo tf.)' \ + --bind 'focus:+bg-transform-border-label(sleep 0.5; echo tbl.)' \ + --bind "focus:+bg-transform-preview-label(sleep 0.5; echo tpl.)" \ + --bind 'focus:+bg-transform-input-label(sleep 0.5; echo til.)' \ + --bind 'focus:+bg-transform-list-label(sleep 0.5; echo tll.)' \ + --bind 'focus:+bg-transform-header-label(sleep 0.5; echo thl.)' \ + --bind 'focus:+bg-transform-footer-label(sleep 0.5; echo tfl.)' \ + --bind 'focus:+bg-transform-prompt(sleep 0.5; echo tp.)' \ + --bind 'focus:+bg-transform-ghost(sleep 0.5; echo tg.)' + ).strip, :Enter + tmux.until do |lines| + assert lines.any_include?('100/100') + %w[th tf tbl tpl til tll thl tfl tp tg].each do + assert lines.any_include?("#{it}.") + end + end + elapsed = Time.now - time + assert elapsed < 2 + end end |
