public this repo is viewable by everyone
Description: Most awesome pagination solution for Rails
Homepage: http://github.com/mislav/will_paginate/wikis
Clone URL: git://github.com/mislav/will_paginate.git
test cases for link renderer options
chriseppstein (author)
17 days ago
mislav (committer)
16 days ago
commit  5586e8ea4b99394baa4a60539e766aa9d2a8a8b6
tree    a405d5d69cae06501f5e8d3275ecd2a45c79a168
parent  85e6d44e738d0bf27cbbcc6cdd60d994a9c3e1c5
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
5
6
...
43
44
45
 
 
 
 
 
 
 
 
 
 
 
 
46
47
48
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
0
@@ -1,6 +1,22 @@
0
 require 'helper'
0
 require 'lib/view_test_process'
0
 
0
+class AdditionalLinkAttributesRenderer < WillPaginate::LinkRenderer
0
+ def initialize(*arguments)
0
+ if arguments.size == 3
0
+ super(*arguments)
0
+ @additional_link_attributes = {:default => 'true'}
0
+ else
0
+ @additional_link_attributes = arguments.extract_options!
0
+ end
0
+ end
0
+
0
+ def page_link(page, text, attributes = {})
0
+ @template.link_to text, url_for(page), attributes.merge(@additional_link_attributes)
0
+ end
0
+end
0
+
0
+
0
 class ViewTest < WillPaginate::ViewTestCase
0
   
0
   ## basic pagination ##
0
@@ -43,6 +59,18 @@ class ViewTest < WillPaginate::ViewTestCase
0
     end
0
   end
0
 
0
+ def test_will_paginate_using_renderer_class
0
+ paginate({},:renderer => AdditionalLinkAttributesRenderer) do
0
+ assert_select 'a[default~=true]'
0
+ end
0
+ end
0
+
0
+ def test_will_paginate_using_renderer_instance
0
+ paginate({},:renderer => AdditionalLinkAttributesRenderer.new(:title => 'rendered')) do
0
+ assert_select 'a[title=rendered]'
0
+ end
0
+ end
0
+
0
   def test_prev_next_links_have_classnames
0
     paginate do |pagination|
0
       assert_select 'span.disabled.prev_page:first-child'

Comments

    No one has commented yet.