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