summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-06-21 22:41:33 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-06-21 22:41:33 +0900
commit17dd833925d31c5811bd465229e57d23c0772687 (patch)
tree24786217b2c532af78c8a82321921871a852e806 /test
parentc33258832eeb855c0a269980aef89c37a7e13d6a (diff)
Add preview action for --bind
Fix #2010 Fix #1638
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 2b865ea9..e1e22575 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -1757,6 +1757,36 @@ class TestGoFZF < TestBase
tmux.send_keys :BSpace
tmux.until { |lines| lines.item_count == 100 && lines.match_count == 100 }
end
+
+ def test_preview_bindings_with_default_preview
+ tmux.send_keys "seq 10 | #{FZF} --preview 'echo [{}]' --bind 'a:preview(echo [{}{}]),b:preview(echo [{}{}{}]),c:refresh-preview'", :Enter
+ tmux.until { |lines| lines.item_count == 10 }
+ tmux.until { |lines| assert_includes lines[1], '[1]' }
+ tmux.send_keys 'a'
+ tmux.until { |lines| assert_includes lines[1], '[11]' }
+ tmux.send_keys 'c'
+ tmux.until { |lines| assert_includes lines[1], '[1]' }
+ tmux.send_keys 'b'
+ tmux.until { |lines| assert_includes lines[1], '[111]' }
+ tmux.send_keys :Up
+ tmux.until { |lines| assert_includes lines[1], '[2]' }
+ end
+
+ def test_preview_bindings_without_default_preview
+ tmux.send_keys "seq 10 | #{FZF} --bind 'a:preview(echo [{}{}]),b:preview(echo [{}{}{}]),c:refresh-preview'", :Enter
+ tmux.until { |lines| lines.item_count == 10 }
+ tmux.until { |lines| refute_includes lines[1], '1' }
+ tmux.send_keys 'a'
+ tmux.until { |lines| assert_includes lines[1], '[11]' }
+ tmux.send_keys 'c' # does nothing
+ tmux.until { |lines| assert_includes lines[1], '[11]' }
+ tmux.send_keys 'b'
+ tmux.until { |lines| assert_includes lines[1], '[111]' }
+ tmux.send_keys 9
+ tmux.until { |lines| lines.match_count == 1 }
+ tmux.until { |lines| refute_includes lines[1], '2' }
+ tmux.until { |lines| assert_includes lines[1], '[111]' }
+ end
end
module TestShell