summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@idaemons.org>2018-06-10 01:41:50 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2018-06-10 01:41:50 +0900
commitdaa1958f8602f91f6df6dac7a87c93da53aed5e4 (patch)
tree7bdf481a8f0424f7a86f7572fcb0a68f95285529 /test
parent2c26f02f5ce263820a339595517152b70ed63b80 (diff)
Provide an option to reverse items only (#1267)
Diffstat (limited to 'test')
-rwxr-xr-x[-rw-r--r--]test/test_go.rb47
1 files changed, 45 insertions, 2 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 4f4f94e1..c7758068 100644..100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -1060,6 +1060,21 @@ class TestGoFZF < TestBase
assert_equal '50', readonce.chomp
end
+ def test_header_lines_reverse_list
+ tmux.send_keys "seq 100 | #{fzf '--header-lines=10 -q 5 --layout=reverse-list'}", :Enter
+ 2.times do
+ tmux.until do |lines|
+ lines[0] == '> 50' &&
+ lines[-4] == ' 2' &&
+ lines[-3] == ' 1' &&
+ lines[-2].include?('/90')
+ end
+ tmux.send_keys :Up
+ end
+ tmux.send_keys :Enter
+ assert_equal '50', readonce.chomp
+ end
+
def test_header_lines_overflow
tmux.send_keys "seq 100 | #{fzf '--header-lines=200'}", :Enter
tmux.until do |lines|
@@ -1087,7 +1102,8 @@ class TestGoFZF < TestBase
header = File.readlines(FILE).take(5).map(&:strip)
tmux.until do |lines|
lines[-2].include?('100/100') &&
- lines[-7..-3].map(&:strip) == header
+ lines[-7..-3].map(&:strip) == header &&
+ lines[-8] == '> 1'
end
end
@@ -1096,7 +1112,18 @@ class TestGoFZF < TestBase
header = File.readlines(FILE).take(5).map(&:strip)
tmux.until do |lines|
lines[1].include?('100/100') &&
- lines[2..6].map(&:strip) == header
+ lines[2..6].map(&:strip) == header &&
+ lines[7] == '> 1'
+ end
+ end
+
+ def test_header_reverse_list
+ tmux.send_keys "seq 100 | #{fzf "--header=\\\"\\$(head -5 #{FILE})\\\" --layout=reverse-list"}", :Enter
+ header = File.readlines(FILE).take(5).map(&:strip)
+ tmux.until do |lines|
+ lines[-2].include?('100/100') &&
+ lines[-7..-3].map(&:strip) == header &&
+ lines[0] == '> 1'
end
end
@@ -1120,6 +1147,16 @@ class TestGoFZF < TestBase
end
end
+ def test_header_and_header_lines_reverse_list
+ tmux.send_keys "seq 100 | #{fzf "--layout=reverse-list --header-lines 10 --header \\\"\\$(head -5 #{FILE})\\\""}", :Enter
+ header = File.readlines(FILE).take(5).map(&:strip)
+ tmux.until do |lines|
+ lines[-2].include?('90/90') &&
+ lines[-7...-2].map(&:strip) == header &&
+ lines[-17...-7].map(&:strip) == (1..10).map(&:to_s).reverse
+ end
+ end
+
def test_cancel
tmux.send_keys "seq 10 | #{fzf '--bind 2:cancel'}", :Enter
tmux.until { |lines| lines[-2].include?('10/10') }
@@ -1145,6 +1182,12 @@ class TestGoFZF < TestBase
tmux.send_keys :Enter
end
+ def test_margin_reverse_list
+ tmux.send_keys "yes | head -1000 | #{fzf '--margin 5,3 --layout=reverse-list'}", :Enter
+ tmux.until { |lines| lines[4] == '' && lines[5] == ' > y' }
+ tmux.send_keys :Enter
+ end
+
def test_tabstop
writelines tempname, ["f\too\tba\tr\tbaz\tbarfooq\tux"]
{