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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2014 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. test "browsing to a missing page should render the base layout" do
  27. get "/users/100000000"
  28. assert_response :not_found
  29. # UsersController uses the admin layout by default
  30. assert_select "#admin-menu", :count => 0
  31. end
  32. test "browsing to an unauthorized page should render the base layout" do
  33. change_user_password('miscuser9', 'test1234')
  34. log_user('miscuser9','test1234')
  35. get "/admin"
  36. assert_response :forbidden
  37. assert_select "#admin-menu", :count => 0
  38. end
  39. def test_top_menu_and_search_not_visible_when_login_required
  40. with_settings :login_required => '1' do
  41. get '/'
  42. assert_select "#top-menu > ul", 0
  43. assert_select "#quick-search", 0
  44. end
  45. end
  46. def test_top_menu_and_search_visible_when_login_not_required
  47. with_settings :login_required => '0' do
  48. get '/'
  49. assert_select "#top-menu > ul"
  50. assert_select "#quick-search"
  51. end
  52. end
  53. def test_wiki_formatter_header_tags
  54. Role.anonymous.add_permission! :add_issues
  55. get '/projects/ecookbook/issues/new'
  56. assert_tag :script,
  57. :attributes => {:src => %r{^/javascripts/jstoolbar/jstoolbar-textile.min.js}},
  58. :parent => {:tag => 'head'}
  59. end
  60. def test_calendar_header_tags
  61. with_settings :default_language => 'fr' do
  62. get '/issues'
  63. assert_include "/javascripts/i18n/jquery.ui.datepicker-fr.js", response.body
  64. end
  65. with_settings :default_language => 'en-GB' do
  66. get '/issues'
  67. assert_include "/javascripts/i18n/jquery.ui.datepicker-en-GB.js", response.body
  68. end
  69. with_settings :default_language => 'en' do
  70. get '/issues'
  71. assert_not_include "/javascripts/i18n/jquery.ui.datepicker", response.body
  72. end
  73. with_settings :default_language => 'zh' do
  74. get '/issues'
  75. assert_include "/javascripts/i18n/jquery.ui.datepicker-zh-CN.js", response.body
  76. end
  77. with_settings :default_language => 'zh-TW' do
  78. get '/issues'
  79. assert_include "/javascripts/i18n/jquery.ui.datepicker-zh-TW.js", response.body
  80. end
  81. with_settings :default_language => 'pt' do
  82. get '/issues'
  83. assert_include "/javascripts/i18n/jquery.ui.datepicker-pt.js", response.body
  84. end
  85. with_settings :default_language => 'pt-BR' do
  86. get '/issues'
  87. assert_include "/javascripts/i18n/jquery.ui.datepicker-pt-BR.js", response.body
  88. end
  89. end
  90. def test_search_field_outside_project_should_link_to_global_search
  91. get '/'
  92. assert_select 'div#quick-search form[action=/search]'
  93. end
  94. def test_search_field_inside_project_should_link_to_project_search
  95. get '/projects/ecookbook'
  96. assert_select 'div#quick-search form[action=/projects/ecookbook/search]'
  97. end
  98. end