diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-03-15 10:51:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-03-15 10:51:22 +0000 |
commit | e26ab0d4a251cc8fcd476a6140bccfcd24a9c446 (patch) | |
tree | ff241ea8d3fa68a09572ce776484d23274c002e8 /test/functional/documents_controller_test.rb | |
parent | c5c335924b8e8b3f5f8a631f918d07416536c9fd (diff) | |
download | redmine-e26ab0d4a251cc8fcd476a6140bccfcd24a9c446.tar.gz redmine-e26ab0d4a251cc8fcd476a6140bccfcd24a9c446.zip |
Show recent documents first (#29725).
Patch by Yuichi HARADA.
git-svn-id: http://svn.redmine.org/redmine/trunk@17972 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/documents_controller_test.rb')
-rw-r--r-- | test/functional/documents_controller_test.rb | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index ce43b5097..81cfec4c7 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -47,13 +47,32 @@ class DocumentsControllerTest < Redmine::ControllerTest end end + def test_index_grouped_by_category + get :index, :params => { + :project_id => 'ecookbook', + :sort_by => 'category' + } + assert_response :success + assert_select '#content' do + # ascending order of DocumentCategory#id. + ['Uncategorized', 'Technical documentation'].each_with_index do |text,idx| + assert_select "h3:nth-of-type(#{idx + 1})", :text => text + end + end + end + def test_index_grouped_by_date get :index, :params => { :project_id => 'ecookbook', :sort_by => 'date' } assert_response :success - assert_select 'h3', :text => '2007-02-12' + assert_select '#content' do + # descending order of date. + ['2007-03-05', '2007-02-12'].each_with_index do |text,idx| + assert_select "h3:nth-of-type(#{idx + 1})", :text => text + end + end end def test_index_grouped_by_title @@ -62,7 +81,12 @@ class DocumentsControllerTest < Redmine::ControllerTest :sort_by => 'title' } assert_response :success - assert_select 'h3', :text => 'T' + assert_select '#content' do + # ascending order of title. + ['A', 'T'].each_with_index do |text,idx| + assert_select "h3:nth-of-type(#{idx + 1})", :text => text + end + end end def test_index_grouped_by_author @@ -71,8 +95,13 @@ class DocumentsControllerTest < Redmine::ControllerTest :sort_by => 'author' } assert_response :success - assert_select 'h3', :text => 'John Smith' - end + assert_select '#content' do + # ascending order of author. + ['John Smith', 'Redmine Admin'].each_with_index do |text,idx| + assert_select "h3:nth-of-type(#{idx + 1})", :text => text + end + end + end def test_index_with_long_description # adds a long description to the first document |