comparison .svn/pristine/98/9804b3e3abfd00a58dec9be4b531677efbf34d66.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
1 # 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 MenuManagerTest < ActionController::IntegrationTest
21 include Redmine::I18n
22
23 fixtures :projects, :trackers, :issue_statuses, :issues,
24 :enumerations, :users, :issue_categories,
25 :projects_trackers,
26 :roles,
27 :member_roles,
28 :members,
29 :enabled_modules
30
31 def test_project_menu_with_specific_locale
32 get 'projects/ecookbook/issues', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
33
34 assert_tag :div, :attributes => { :id => 'main-menu' },
35 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity),
36 :attributes => { :href => '/projects/ecookbook/activity',
37 :class => 'activity' } } }
38 assert_tag :div, :attributes => { :id => 'main-menu' },
39 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_issue_plural),
40 :attributes => { :href => '/projects/ecookbook/issues',
41 :class => 'issues selected' } } }
42 end
43
44 def test_project_menu_with_additional_menu_items
45 Setting.default_language = 'en'
46 assert_no_difference 'Redmine::MenuManager.items(:project_menu).size' do
47 Redmine::MenuManager.map :project_menu do |menu|
48 menu.push :foo, { :controller => 'projects', :action => 'show' }, :caption => 'Foo'
49 menu.push :bar, { :controller => 'projects', :action => 'show' }, :before => :activity
50 menu.push :hello, { :controller => 'projects', :action => 'show' }, :caption => Proc.new {|p| p.name.upcase }, :after => :bar
51 end
52
53 get 'projects/ecookbook'
54 assert_tag :div, :attributes => { :id => 'main-menu' },
55 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Foo',
56 :attributes => { :class => 'foo' } } }
57
58 assert_tag :div, :attributes => { :id => 'main-menu' },
59 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Bar',
60 :attributes => { :class => 'bar' } },
61 :before => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK' } } }
62
63 assert_tag :div, :attributes => { :id => 'main-menu' },
64 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK',
65 :attributes => { :class => 'hello' } },
66 :before => { :tag => 'li', :child => { :tag => 'a', :content => 'Activity' } } }
67
68 # Remove the menu items
69 Redmine::MenuManager.map :project_menu do |menu|
70 menu.delete :foo
71 menu.delete :bar
72 menu.delete :hello
73 end
74 end
75 end
76 end