From 2bbc12063c475cb7c78c7633e2ffad41aa49d233 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 11 Jun 2016 19:59:12 +0900 Subject: Add --preview and --preview-window Close #587 --- test/test_go.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb index bb35bbf0..a6d67190 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1228,6 +1228,28 @@ class TestGoFZF < TestBase assert_equal '3', readonce.chomp end + def test_preview + tmux.send_keys %[seq 1000 | #{FZF} --preview 'echo {{}-{}}' --bind ?:toggle-preview], :Enter + tmux.until { |lines| lines[1].include?(' {1-1}') } + tmux.send_keys '555' + tmux.until { |lines| lines[1].include?(' {555-555}') } + tmux.send_keys '?' + tmux.until { |lines| !lines[1].include?(' {555-555}') } + tmux.send_keys '?' + tmux.until { |lines| lines[1].include?(' {555-555}') } + end + + def test_preview_hidden + tmux.send_keys %[seq 1000 | #{FZF} --preview 'echo {{}-{}}' --preview-window down:1:hidden --bind ?:toggle-preview], :Enter + tmux.until { |lines| lines[-1] == '>' } + tmux.send_keys '?' + tmux.until { |lines| lines[-2].include?(' {1-1}') } + tmux.send_keys '555' + tmux.until { |lines| lines[-2].include?(' {555-555}') } + tmux.send_keys '?' + tmux.until { |lines| lines[-1] == '> 555' } + end + private def writelines path, lines File.unlink path while File.exists? path -- cgit v1.2.3