mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Make sure that link_to_{previous,next}_page work for every view adapter
This commit is contained in:
parent
8b9e5382ef
commit
b2b4c01fa5
2 changed files with 14 additions and 0 deletions
|
@ -35,6 +35,8 @@ class UsersController < ApplicationController
|
|||
@users = User.page params[:page]
|
||||
render inline: <<-ERB
|
||||
<%= @users.map(&:name).join("\n") %>
|
||||
<%= link_to_previous_page @users, 'previous page', class: 'prev' %>
|
||||
<%= link_to_next_page @users, 'next page', class: 'next' %>
|
||||
<%= paginate @users %>
|
||||
<div class="info"><%= page_entries_info @users %></div>
|
||||
ERB
|
||||
|
|
|
@ -18,6 +18,9 @@ class NavigationTest < Test::Unit::TestCase
|
|||
test 'navigating by pagination links' do
|
||||
visit '/users'
|
||||
|
||||
assert page.has_no_content? 'previous page'
|
||||
assert page.has_content? 'next page'
|
||||
|
||||
within 'nav.pagination' do
|
||||
within 'span.page.current' do
|
||||
assert page.has_content? '1'
|
||||
|
@ -27,6 +30,9 @@ class NavigationTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
assert page.has_content? 'previous page'
|
||||
assert page.has_content? 'next page'
|
||||
|
||||
within 'nav.pagination' do
|
||||
within 'span.page.current' do
|
||||
assert page.has_content? '2'
|
||||
|
@ -36,6 +42,9 @@ class NavigationTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
assert page.has_content? 'previous page'
|
||||
assert page.has_no_content? 'next page'
|
||||
|
||||
within 'nav.pagination' do
|
||||
within 'span.page.current' do
|
||||
assert page.has_content? '4'
|
||||
|
@ -45,6 +54,9 @@ class NavigationTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
assert page.has_content? 'previous page'
|
||||
assert page.has_content? 'next page'
|
||||
|
||||
within 'nav.pagination' do
|
||||
within 'span.page.current' do
|
||||
assert page.has_content? '3'
|
||||
|
|
Loading…
Add table
Reference in a new issue