To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 1a / 1a57484f351c2899093aa4b926665fc8327667ab.svn-base @ 1298:4f746d8966dd
History | View | Annotate | Download (3.76 KB)
| 1 | 1295:622f24f53b42 | Chris | # 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 | |||
| 18 | require File.expand_path('../../test_helper', __FILE__)
|
||
| 19 | |||
| 20 | class LayoutTest < ActionController::IntegrationTest |
||
| 21 | fixtures :projects, :trackers, :issue_statuses, :issues, |
||
| 22 | :enumerations, :users, :issue_categories, |
||
| 23 | :projects_trackers, |
||
| 24 | :roles, |
||
| 25 | :member_roles, |
||
| 26 | :members, |
||
| 27 | :enabled_modules |
||
| 28 | |||
| 29 | test "browsing to a missing page should render the base layout" do |
||
| 30 | get "/users/100000000" |
||
| 31 | |||
| 32 | assert_response :not_found |
||
| 33 | |||
| 34 | # UsersController uses the admin layout by default |
||
| 35 | assert_select "#admin-menu", :count => 0 |
||
| 36 | end |
||
| 37 | |||
| 38 | test "browsing to an unauthorized page should render the base layout" do |
||
| 39 | change_user_password('miscuser9', 'test1234')
|
||
| 40 | |||
| 41 | log_user('miscuser9','test1234')
|
||
| 42 | |||
| 43 | get "/admin" |
||
| 44 | assert_response :forbidden |
||
| 45 | assert_select "#admin-menu", :count => 0 |
||
| 46 | end |
||
| 47 | |||
| 48 | def test_top_menu_and_search_not_visible_when_login_required |
||
| 49 | with_settings :login_required => '1' do |
||
| 50 | get '/' |
||
| 51 | assert_select "#top-menu > ul", 0 |
||
| 52 | assert_select "#quick-search", 0 |
||
| 53 | end |
||
| 54 | end |
||
| 55 | |||
| 56 | def test_top_menu_and_search_visible_when_login_not_required |
||
| 57 | with_settings :login_required => '0' do |
||
| 58 | get '/' |
||
| 59 | assert_select "#top-menu > ul" |
||
| 60 | assert_select "#quick-search" |
||
| 61 | end |
||
| 62 | end |
||
| 63 | |||
| 64 | def test_wiki_formatter_header_tags |
||
| 65 | Role.anonymous.add_permission! :add_issues |
||
| 66 | |||
| 67 | get '/projects/ecookbook/issues/new' |
||
| 68 | assert_tag :script, |
||
| 69 | :attributes => {:src => %r{^/javascripts/jstoolbar/jstoolbar-textile.min.js}},
|
||
| 70 | :parent => {:tag => 'head'}
|
||
| 71 | end |
||
| 72 | |||
| 73 | def test_calendar_header_tags |
||
| 74 | with_settings :default_language => 'fr' do |
||
| 75 | get '/issues' |
||
| 76 | assert_include "/javascripts/i18n/jquery.ui.datepicker-fr.js", response.body |
||
| 77 | end |
||
| 78 | |||
| 79 | with_settings :default_language => 'en-GB' do |
||
| 80 | get '/issues' |
||
| 81 | assert_include "/javascripts/i18n/jquery.ui.datepicker-en-GB.js", response.body |
||
| 82 | end |
||
| 83 | |||
| 84 | with_settings :default_language => 'en' do |
||
| 85 | get '/issues' |
||
| 86 | assert_not_include "/javascripts/i18n/jquery.ui.datepicker", response.body |
||
| 87 | end |
||
| 88 | |||
| 89 | with_settings :default_language => 'zh' do |
||
| 90 | get '/issues' |
||
| 91 | assert_include "/javascripts/i18n/jquery.ui.datepicker-zh-CN.js", response.body |
||
| 92 | end |
||
| 93 | |||
| 94 | with_settings :default_language => 'zh-TW' do |
||
| 95 | get '/issues' |
||
| 96 | assert_include "/javascripts/i18n/jquery.ui.datepicker-zh-TW.js", response.body |
||
| 97 | end |
||
| 98 | |||
| 99 | with_settings :default_language => 'pt' do |
||
| 100 | get '/issues' |
||
| 101 | assert_include "/javascripts/i18n/jquery.ui.datepicker-pt.js", response.body |
||
| 102 | end |
||
| 103 | |||
| 104 | with_settings :default_language => 'pt-BR' do |
||
| 105 | get '/issues' |
||
| 106 | assert_include "/javascripts/i18n/jquery.ui.datepicker-pt-BR.js", response.body |
||
| 107 | end |
||
| 108 | end |
||
| 109 | |||
| 110 | def test_search_field_outside_project_should_link_to_global_search |
||
| 111 | get '/' |
||
| 112 | assert_select 'div#quick-search form[action=/search]' |
||
| 113 | end |
||
| 114 | |||
| 115 | def test_search_field_inside_project_should_link_to_project_search |
||
| 116 | get '/projects/ecookbook' |
||
| 117 | assert_select 'div#quick-search form[action=/projects/ecookbook/search]' |
||
| 118 | end |
||
| 119 | end |