parent
f5030681d7
commit
a776f00706
|
@ -171,6 +171,10 @@ module Kaminari
|
||||||
(@page.to_i == @options[:current_page] + @options[:window] + 1) && (@page.to_i == @options[:total_pages] - @options[:right])
|
(@page.to_i == @options[:current_page] + @options[:window] + 1) && (@page.to_i == @options[:total_pages] - @options[:right])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def out_of_range?
|
||||||
|
@page > @options[:total_pages]
|
||||||
|
end
|
||||||
|
|
||||||
# The last rendered tag was "truncated" or not
|
# The last rendered tag was "truncated" or not
|
||||||
def was_truncated?
|
def was_truncated?
|
||||||
@last.is_a? Gap
|
@last.is_a? Gap
|
||||||
|
|
|
@ -233,6 +233,23 @@ describe 'Kaminari::Helpers' do
|
||||||
its("gap for 8") { gap_for(8).should be_a_single_gap }
|
its("gap for 8") { gap_for(8).should be_a_single_gap }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#out_of_range?" do
|
||||||
|
context 'within range' do
|
||||||
|
subject { Paginator::PageProxy.new({:total_pages => 5}, 4, nil).out_of_range? }
|
||||||
|
it { should == false }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on last page' do
|
||||||
|
subject { Paginator::PageProxy.new({:total_pages => 5}, 5, nil).out_of_range? }
|
||||||
|
it { should == false }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'out of range' do
|
||||||
|
subject { Paginator::PageProxy.new({:total_pages => 5}, 6, nil).out_of_range? }
|
||||||
|
it { should == true }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue