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