summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2021-11-02 21:18:29 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2021-11-02 21:48:19 +0900
commit02cee2234dc85af7198f707072fd60a156fc4035 (patch)
tree27e4366b898baf6d644d9a35b00d1776d88edba6 /test
parente0dd2be3fbf10d8125fdbaf80b62a15cc04c88b6 (diff)
Implement --scroll-off=LINES
Close #2533
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 2e33185b..e82a85c1 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -2076,6 +2076,39 @@ class TestGoFZF < TestBase
tmux.send_keys 'C-t'
tmux.until { |lines| assert_includes lines[1], '4' }
end
+
+ def test_scroll_off
+ tmux.send_keys "seq 1000 | #{FZF} --scroll-off=3 --bind l:last", :Enter
+ tmux.until { |lines| assert_equal 1000, lines.item_count }
+ height = tmux.until { |lines| lines }.first.to_i
+ tmux.send_keys :PgUp
+ tmux.until do |lines|
+ assert_equal height + 3, lines.first.to_i
+ assert_equal "> #{height}", lines[3].strip
+ end
+ tmux.send_keys :Up
+ tmux.until { |lines| assert_equal "> #{height + 1}", lines[3].strip }
+ tmux.send_keys 'l'
+ tmux.until { |lines| assert_equal '> 1000', lines.first.strip }
+ tmux.send_keys :PgDn
+ tmux.until { |lines| assert_equal "> #{1000 - height + 1}", lines.reverse[5].strip }
+ tmux.send_keys :Down
+ tmux.until { |lines| assert_equal "> #{1000 - height}", lines.reverse[5].strip }
+ end
+
+ def test_scroll_off_large
+ tmux.send_keys "seq 1000 | #{FZF} --scroll-off=9999", :Enter
+ tmux.until { |lines| assert_equal 1000, lines.item_count }
+ height = tmux.until { |lines| lines }.first.to_i
+ tmux.send_keys :PgUp
+ tmux.until { |lines| assert_equal "> #{height}", lines[height / 2].strip }
+ tmux.send_keys :Up
+ tmux.until { |lines| assert_equal "> #{height + 1}", lines[height / 2].strip }
+ tmux.send_keys :Up
+ tmux.until { |lines| assert_equal "> #{height + 2}", lines[height / 2].strip }
+ tmux.send_keys :Down
+ tmux.until { |lines| assert_equal "> #{height + 1}", lines[height / 2].strip }
+ end
end
module TestShell