@@ -1,77 +1,77 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 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 MenuManagerTest < ActionController::IntegrationTest |
|
21 | 21 | include Redmine::I18n |
|
22 | 22 | |
|
23 | 23 | fixtures :projects, :trackers, :issue_statuses, :issues, |
|
24 | 24 | :enumerations, :users, :issue_categories, |
|
25 | 25 | :projects_trackers, |
|
26 | 26 | :roles, |
|
27 | 27 | :member_roles, |
|
28 | 28 | :members, |
|
29 | 29 | :enabled_modules, |
|
30 | 30 | :workflows |
|
31 | 31 | |
|
32 | 32 | def test_project_menu_with_specific_locale |
|
33 |
get 'projects/ecookbook/issues', { }, ' |
|
|
33 | get 'projects/ecookbook/issues', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' | |
|
34 | 34 | |
|
35 | 35 | assert_tag :div, :attributes => { :id => 'main-menu' }, |
|
36 | 36 | :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity), |
|
37 | 37 | :attributes => { :href => '/projects/ecookbook/activity', |
|
38 | 38 | :class => 'activity' } } } |
|
39 | 39 | assert_tag :div, :attributes => { :id => 'main-menu' }, |
|
40 | 40 | :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_issue_plural), |
|
41 | 41 | :attributes => { :href => '/projects/ecookbook/issues', |
|
42 | 42 | :class => 'issues selected' } } } |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | def test_project_menu_with_additional_menu_items |
|
46 | 46 | Setting.default_language = 'en' |
|
47 | 47 | assert_no_difference 'Redmine::MenuManager.items(:project_menu).size' do |
|
48 | 48 | Redmine::MenuManager.map :project_menu do |menu| |
|
49 | 49 | menu.push :foo, { :controller => 'projects', :action => 'show' }, :caption => 'Foo' |
|
50 | 50 | menu.push :bar, { :controller => 'projects', :action => 'show' }, :before => :activity |
|
51 | 51 | menu.push :hello, { :controller => 'projects', :action => 'show' }, :caption => Proc.new {|p| p.name.upcase }, :after => :bar |
|
52 | 52 | end |
|
53 | 53 | |
|
54 | 54 | get 'projects/ecookbook' |
|
55 | 55 | assert_tag :div, :attributes => { :id => 'main-menu' }, |
|
56 | 56 | :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Foo', |
|
57 | 57 | :attributes => { :class => 'foo' } } } |
|
58 | 58 | |
|
59 | 59 | assert_tag :div, :attributes => { :id => 'main-menu' }, |
|
60 | 60 | :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Bar', |
|
61 | 61 | :attributes => { :class => 'bar' } }, |
|
62 | 62 | :before => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK' } } } |
|
63 | 63 | |
|
64 | 64 | assert_tag :div, :attributes => { :id => 'main-menu' }, |
|
65 | 65 | :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK', |
|
66 | 66 | :attributes => { :class => 'hello' } }, |
|
67 | 67 | :before => { :tag => 'li', :child => { :tag => 'a', :content => 'Activity' } } } |
|
68 | 68 | |
|
69 | 69 | # Remove the menu items |
|
70 | 70 | Redmine::MenuManager.map :project_menu do |menu| |
|
71 | 71 | menu.delete :foo |
|
72 | 72 | menu.delete :bar |
|
73 | 73 | menu.delete :hello |
|
74 | 74 | end |
|
75 | 75 | end |
|
76 | 76 | end |
|
77 | 77 | end |
General Comments 0
You need to be logged in to leave comments.
Login now