You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

layout_test.rb 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2013 Jean-Philippe Lang
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. require File.expand_path('../../test_helper', __FILE__)
  18. class LayoutTest < ActionController::IntegrationTest
  19. fixtures :projects, :trackers, :issue_statuses, :issues,
  20. :enumerations, :users, :issue_categories,
  21. :projects_trackers,
  22. :roles,
  23. :member_roles,
  24. :members,
  25. :enabled_modules,
  26. :workflows
  27. test "browsing to a missing page should render the base layout" do
  28. get "/users/100000000"
  29. assert_response :not_found
  30. # UsersController uses the admin layout by default
  31. assert_select "#admin-menu", :count => 0
  32. end
  33. test "browsing to an unauthorized page should render the base layout" do
  34. change_user_password('miscuser9', 'test1234')
  35. log_user('miscuser9','test1234')
  36. get "/admin"
  37. assert_response :forbidden
  38. assert_select "#admin-menu", :count => 0
  39. end
  40. def test_top_menu_and_search_not_visible_when_login_required
  41. with_settings :login_required => '1' do
  42. get '/'
  43. assert_select "#top-menu > ul", 0
  44. assert_select "#quick-search", 0
  45. end
  46. end
  47. def test_top_menu_and_search_visible_when_login_not_required
  48. with_settings :login_required => '0' do
  49. get '/'
  50. assert_select "#top-menu > ul"
  51. assert_select "#quick-search"
  52. end
  53. end
  54. def test_wiki_formatter_header_tags
  55. Role.anonymous.add_permission! :add_issues
  56. get '/projects/ecookbook/issues/new'
  57. assert_tag :script,
  58. :attributes => {:src => %r{^/javascripts/jstoolbar/jstoolbar-textile.min.js}},
  59. :parent => {:tag => 'head'}
  60. end
  61. def test_calendar_header_tags
  62. with_settings :default_language => 'fr' do
  63. get '/issues'
  64. assert_include "/javascripts/i18n/jquery.ui.datepicker-fr.js", response.body
  65. end
  66. with_settings :default_language => 'en-GB' do
  67. get '/issues'
  68. assert_include "/javascripts/i18n/jquery.ui.datepicker-en-GB.js", response.body
  69. end
  70. with_settings :default_language => 'en' do
  71. get '/issues'
  72. assert_not_include "/javascripts/i18n/jquery.ui.datepicker", response.body
  73. end
  74. end
  75. def test_search_field_outside_project_should_link_to_global_search
  76. get '/'
  77. assert_select 'div#quick-search form[action=/search]'
  78. end
  79. def test_search_field_inside_project_should_link_to_project_search
  80. get '/projects/ecookbook'
  81. assert_select 'div#quick-search form[action=/projects/ecookbook/search]'
  82. end
  83. end