From daa1958f8602f91f6df6dac7a87c93da53aed5e4 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Sun, 10 Jun 2018 01:41:50 +0900 Subject: Provide an option to reverse items only (#1267) --- test/test_go.rb | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) mode change 100644 => 100755 test/test_go.rb (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb old mode 100644 new mode 100755 index 4f4f94e1..c7758068 --- 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"] { -- cgit v1.2.3