Adaptive display of "Per page" links (#7720).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9664 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-05-10 18:51:11 +00:00
parent 0bb937152b
commit 5bd90548b0
2 changed files with 31 additions and 4 deletions
@@ -1088,4 +1088,19 @@ RAW
def test_javascript_include_tag_for_plugin_should_pick_the_plugin_javascript
assert_match 'src="/plugin_assets/foo/javascripts/scripts.js"', javascript_include_tag("scripts", :plugin => :foo)
end
def test_per_page_links_should_show_usefull_values
set_language_if_valid 'en'
stubs(:link_to).returns("[link]")
with_settings :per_page_options => '10, 25, 50, 100' do
assert_nil per_page_links(10, 3)
assert_nil per_page_links(25, 3)
assert_equal "Per page: 10, [link]", per_page_links(10, 22)
assert_equal "Per page: [link], 25", per_page_links(25, 22)
assert_equal "Per page: [link], [link], 50", per_page_links(50, 22)
assert_equal "Per page: [link], 25, [link]", per_page_links(25, 26)
assert_equal "Per page: [link], 25, [link], [link]", per_page_links(25, 120)
end
end
end