summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-04-22 22:01:00 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-04-22 22:01:37 +0900
commit6be855be6af102a0f89932e5752ce75aa9713108 (patch)
tree59c7190a02bcd71fb970557a124d518324e3dfe4 /test
parentb6e3f4423bfb489f271282ea858e453ece5ab22b (diff)
downloadfzf-6be855be6af102a0f89932e5752ce75aa9713108.tar.gz
Add change-header and transform-header
Close #3237
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index d1fa2c37..34884550 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -1865,6 +1865,67 @@ class TestGoFZF < TestBase
tmux.until { |lines| assert_equal '>', lines.last }
end
+ def test_change_and_transform_header
+ [
+ 'space:change-header:$(seq 4)',
+ 'space:transform-header:seq 4'
+ ].each_with_index do |binding, i|
+ tmux.send_keys %(seq 3 | #{FZF} --header-lines 2 --header bar --bind "#{binding}"), :Enter
+ expected = <<~OUTPUT
+ > 3
+ 2
+ 1
+ bar
+ 1/1
+ >
+ OUTPUT
+ tmux.until { assert_block(expected, _1) }
+ tmux.send_keys :Space
+ expected = <<~OUTPUT
+ > 3
+ 2
+ 1
+ 1
+ 2
+ 3
+ 4
+ 1/1
+ >
+ OUTPUT
+ tmux.until { assert_block(expected, _1) }
+ next unless i.zero?
+
+ teardown
+ setup
+ end
+ end
+
+ def test_change_header
+ tmux.send_keys %(seq 3 | #{FZF} --header-lines 2 --header bar --bind "space:change-header:$(seq 4)"), :Enter
+ expected = <<~OUTPUT
+ > 3
+ 2
+ 1
+ bar
+ 1/1
+ >
+ OUTPUT
+ tmux.until { assert_block(expected, _1) }
+ tmux.send_keys :Space
+ expected = <<~OUTPUT
+ > 3
+ 2
+ 1
+ 1
+ 2
+ 3
+ 4
+ 1/1
+ >
+ OUTPUT
+ tmux.until { assert_block(expected, _1) }
+ end
+
def test_change_query
tmux.send_keys %(: | #{FZF} --query foo --bind space:change-query:foobar), :Enter
tmux.until { |lines| assert_equal 0, lines.item_count }