comparison .svn/pristine/d2/d2bd0bf95ab05008a71c2b2b37ad8bf69fcda9be.svn-base @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents
children
comparison
equal deleted inserted replaced
908:c6c2cbd0afee 909:cbb26bc654de
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 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 :workflows
31
32 def test_project_menu_with_specific_locale
33 get 'projects/ecookbook/issues', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
34
35 assert_tag :div, :attributes => { :id => 'main-menu' },
36 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity),
37 :attributes => { :href => '/projects/ecookbook/activity',
38 :class => 'activity' } } }
39 assert_tag :div, :attributes => { :id => 'main-menu' },
40 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_issue_plural),
41 :attributes => { :href => '/projects/ecookbook/issues',
42 :class => 'issues selected' } } }
43 end
44
45 def test_project_menu_with_additional_menu_items
46 Setting.default_language = 'en'
47 assert_no_difference 'Redmine::MenuManager.items(:project_menu).size' do
48 Redmine::MenuManager.map :project_menu do |menu|
49 menu.push :foo, { :controller => 'projects', :action => 'show' }, :caption => 'Foo'
50 menu.push :bar, { :controller => 'projects', :action => 'show' }, :before => :activity
51 menu.push :hello, { :controller => 'projects', :action => 'show' }, :caption => Proc.new {|p| p.name.upcase }, :after => :bar
52 end
53
54 get 'projects/ecookbook'
55 assert_tag :div, :attributes => { :id => 'main-menu' },
56 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Foo',
57 :attributes => { :class => 'foo' } } }
58
59 assert_tag :div, :attributes => { :id => 'main-menu' },
60 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Bar',
61 :attributes => { :class => 'bar' } },
62 :before => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK' } } }
63
64 assert_tag :div, :attributes => { :id => 'main-menu' },
65 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK',
66 :attributes => { :class => 'hello' } },
67 :before => { :tag => 'li', :child => { :tag => 'a', :content => 'Activity' } } }
68
69 # Remove the menu items
70 Redmine::MenuManager.map :project_menu do |menu|
71 menu.delete :foo
72 menu.delete :bar
73 menu.delete :hello
74 end
75 end
76 end
77 end