public
Rubygem
Fork of mislav/will_paginate
Description: Most awesome pagination solution for Rails
Homepage: http://github.com/mislav/will_paginate/wikis
Clone URL: git://github.com/chriseppstein/will_paginate.git
Search Repo:
test cases for link renderer options
chriseppstein (author)
Mon Apr 28 21:26:43 -0700 2008
commit  aa9cfe346c1bbce83eb5b4d13ba80d99f455c9c1
tree    94dbca1e4bed8d4b91fdae67ee6f4d0305c36745
parent  84313aa4ec6d354de94d5d78ab78fbc52d3f7c17
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
5
6
...
40
41
42
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
@@ -40,6 +56,18 @@
0
         end
0
       end
0
       assert_select 'span.current', '2'
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
 

Comments

    No one has commented yet.