diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:42:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:42:20 +0000 |
commit | 45f039187df03e8925cb0d08ccc1838c9ea2d5c2 (patch) | |
tree | 3bbb8958c71b24e65123c0e8f29d6f15726424d5 /test | |
parent | ecd9d9ba2f43f2f5a88c1d34d34d07dae40dfe4e (diff) | |
download | redmine-45f039187df03e8925cb0d08ccc1838c9ea2d5c2.tar.gz redmine-45f039187df03e8925cb0d08ccc1838c9ea2d5c2.zip |
Option to switch between table list and board list (#29482).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@18765 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/projects_controller_test.rb | 53 | ||||
-rw-r--r-- | test/unit/project_query_test.rb | 11 |
2 files changed, 64 insertions, 0 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 3f4dd6967..5e1efd240 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -94,6 +94,59 @@ class ProjectsControllerTest < Redmine::ControllerTest end end + def test_index_as_list_should_format_column_value + get :index, :params => { + :c => ['name', 'status', 'short_description', 'homepage', 'parent_id', 'identifier', 'is_public', 'created_on', 'project.cf_3'], + :display_type => 'list' + } + assert_response :success + + assert_select 'table.projects' do + assert_select 'tr[id=?]', 'project-1' do + assert_select 'td.name a[href=?]', '/projects/ecookbook', :text => 'eCookbook' + assert_select 'td.status', :text => 'active' + assert_select 'td.short_description', :text => 'Recipes management application' + assert_select 'td.homepage a.external', :text => 'http://ecookbook.somenet.foo/' + assert_select 'td.identifier', :text => 'ecookbook' + assert_select 'td.is_public', :text => 'Yes' + assert_select 'td.created_on', :text => '07/19/2006 05:13 PM' + assert_select 'td.project_cf_3.list', :text => 'Stable' + end + assert_select 'tr[id=?]', 'project-4' do + assert_select 'td.parent_id a[href=?]', '/projects/ecookbook', :text => 'eCookbook' + end + end + end + + def test_index_as_list_should_show_my_favourite_projects + @request.session[:user_id] = 1 + get :index, :params => { + :display_type => 'list' + } + + assert_response :success + assert_select 'tr[id=?] td.name span[class=?]', 'project-5', 'icon icon-user my-project' + end + + def test_index_as_list_should_indent_projects + @request.session[:user_id] = 1 + get :index, :params => { + :c => ['name', 'short_description'], + :sort => 'parent_id:desc,lft:desc', + :display_type => 'list' + } + assert_response :success + + child_level1 = css_select('tr#project-5').map {|e| e.attr('class')}.first.split(' ') + child_level2 = css_select('tr#project-6').map {|e| e.attr('class')}.first.split(' ') + + assert_include 'idnt', child_level1 + assert_include 'idnt-1', child_level1 + + assert_include 'idnt', child_level2 + assert_include 'idnt-2', child_level2 + end + def test_autocomplete_js get :autocomplete, :params => { :format => 'js', diff --git a/test/unit/project_query_test.rb b/test/unit/project_query_test.rb index f4182e560..43e95d308 100644 --- a/test/unit/project_query_test.rb +++ b/test/unit/project_query_test.rb @@ -44,6 +44,17 @@ class ProjectQueryTest < ActiveSupport::TestCase values = query.available_filters['status'][:values] assert_equal ['active', 'closed'], values.map(&:first) assert_equal ['1', '5'], values.map(&:second) + end + + def test_default_columns + q = ProjectQuery.new + assert q.columns.any? + assert q.inline_columns.any? + assert q.block_columns.empty? + end + def test_available_columns_should_include_project_custom_fields + query = ProjectQuery.new + assert_include :"project.cf_3", query.available_columns.map(&:name) end end |