diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-31 17:33:53 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-31 17:34:11 +0900 |
| commit | aa2b9ec47652e84f320dad512c179feb46c8364c (patch) | |
| tree | 0179c14c43d4d1bb20c5306bef5f98a70f44eaa3 /test | |
| parent | 3ee00f8bc281e98e06689c127ebd09c0ed123929 (diff) | |
| download | fzf-aa2b9ec47652e84f320dad512c179feb46c8364c.tar.gz | |
Add 'show-preview' and 'hide-preview'
For cases where 'toggle-preview' is not enough
Diffstat (limited to 'test')
| -rwxr-xr-x | test/test_go.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb index 9d95a0a1..1816191d 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1495,6 +1495,45 @@ class TestGoFZF < TestBase end end + def test_show_and_hide_preview + tmux.send_keys %(seq 100 | #{FZF} --preview-window hidden,border-bold --preview 'echo [{}]' --bind 'a:show-preview,b:hide-preview'), :Enter + + # Hidden by default + tmux.until do |lines| + assert_equal 100, lines.match_count + refute_includes lines[1], '┃ [1]' + end + + # Show + tmux.send_keys :a + tmux.until { |lines| assert_includes lines[1], '┃ [1]' } + + # Already shown + tmux.send_keys :a + tmux.send_keys :Up + tmux.until { |lines| assert_includes lines[1], '┃ [2]' } + + # Hide + tmux.send_keys :b + tmux.send_keys :Up + tmux.until do |lines| + assert_includes lines, '> 3' + refute_includes lines[1], '┃ [3]' + end + + # Already hidden + tmux.send_keys :b + tmux.send_keys :Up + tmux.until do |lines| + assert_includes lines, '> 4' + refute_includes lines[1], '┃ [4]' + end + + # Show it again + tmux.send_keys :a + tmux.until { |lines| assert_includes lines[1], '┃ [4]' } + end + def test_preview_hidden tmux.send_keys %(seq 1000 | #{FZF} --preview 'echo {{}-{}-$FZF_PREVIEW_LINES-$FZF_PREVIEW_COLUMNS}' --preview-window down:1:hidden --bind ?:toggle-preview), :Enter tmux.until { |lines| assert_equal '>', lines[-1] } |
