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