fixes #2 show nothing when num_page == 1
This commit is contained in:
parent
e6481a1c89
commit
23186e5c9c
|
@ -67,6 +67,7 @@ module Kaminari
|
|||
|
||||
def tagify_links
|
||||
num_pages, current_page, left, window, right = @options[:num_pages], @options[:current_page], @left, @window, @right
|
||||
return [] if num_pages <= 1
|
||||
|
||||
tags = []
|
||||
tags << (current_page > 1 ? PrevLink.new(self) : PrevSpan.new(self))
|
||||
|
|
|
@ -15,6 +15,12 @@ describe 'Kaminari::Helpers::PaginationRenderer' do
|
|||
PaginationRenderer.new(renderer, options).tagify_links
|
||||
end
|
||||
|
||||
context '1 page in total' do
|
||||
subject { tags_with :num_pages => 1, :current_page => 1 }
|
||||
it { should have(0).tags }
|
||||
end
|
||||
|
||||
context '10 pages in total' do
|
||||
context 'first page' do
|
||||
subject { tags_with :num_pages => 10, :current_page => 1 }
|
||||
it { should_not contain_tag PrevLink }
|
||||
|
@ -107,3 +113,4 @@ describe 'Kaminari::Helpers::PaginationRenderer' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue