mirror of
https://github.com/redmine/redmine.git
synced 2025-11-11 15:56:03 +01:00
fix source indent of test/unit/lib/redmine/menu_manager/menu_helper_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20199 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -94,21 +94,25 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
|
||||
|
||||
def test_render_menu_node_with_children
|
||||
User.current = User.find(2)
|
||||
parent_node = Redmine::MenuManager::MenuItem.new(
|
||||
parent_node =
|
||||
Redmine::MenuManager::MenuItem.
|
||||
new(
|
||||
:parent_node,
|
||||
'/test',
|
||||
{
|
||||
:children => Proc.new {|p|
|
||||
:children => Proc.new do |p|
|
||||
children = []
|
||||
3.times do |time|
|
||||
children << Redmine::MenuManager::MenuItem.new(
|
||||
"test_child_#{time}",
|
||||
{:controller => 'issues', :action => 'index'},
|
||||
{})
|
||||
{}
|
||||
)
|
||||
end
|
||||
children
|
||||
end
|
||||
}
|
||||
})
|
||||
)
|
||||
@output_buffer = render_menu_node(parent_node, Project.find(1))
|
||||
|
||||
assert_select("li") do
|
||||
@@ -123,33 +127,43 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
|
||||
|
||||
def test_render_menu_node_with_nested_items_and_children
|
||||
User.current = User.find(2)
|
||||
|
||||
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node,
|
||||
parent_node =
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
:parent_node,
|
||||
{:controller => 'issues', :action => 'index'},
|
||||
{
|
||||
:children => Proc.new {|p|
|
||||
:children => Proc.new do |p|
|
||||
children = []
|
||||
3.times do |time|
|
||||
children << Redmine::MenuManager::MenuItem.new("test_child_#{time}", {:controller => 'issues', :action => 'index'}, {})
|
||||
children <<
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
"test_child_#{time}",
|
||||
{:controller => 'issues', :action => 'index'}, {}
|
||||
)
|
||||
end
|
||||
children
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
parent_node << Redmine::MenuManager::MenuItem.new(
|
||||
)
|
||||
parent_node <<
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
:child_node,
|
||||
{:controller => 'issues', :action => 'index'},
|
||||
{
|
||||
:children =>
|
||||
Proc.new {|p|
|
||||
Proc.new do |p|
|
||||
children = []
|
||||
6.times do |time|
|
||||
children << Redmine::MenuManager::MenuItem.new(
|
||||
"test_dynamic_child_#{time}", {:controller => 'issues', :action => 'index'}, {})
|
||||
children <<
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
"test_dynamic_child_#{time}",
|
||||
{:controller => 'issues', :action => 'index'}, {}
|
||||
)
|
||||
end
|
||||
children
|
||||
end
|
||||
}
|
||||
})
|
||||
)
|
||||
@output_buffer = render_menu_node(parent_node, Project.find(1))
|
||||
|
||||
assert_select("li") do
|
||||
@@ -173,18 +187,25 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
|
||||
|
||||
def test_render_menu_node_with_allowed_and_unallowed_unattached_children
|
||||
User.current = User.find(2)
|
||||
|
||||
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node,
|
||||
parent_node =
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
:parent_node,
|
||||
{:controller => 'issues', :action => 'index'},
|
||||
{
|
||||
:children => Proc.new {|p|
|
||||
:children => Proc.new do |p|
|
||||
[
|
||||
Redmine::MenuManager::MenuItem.new("test_child_allowed", {:controller => 'issues', :action => 'index'}, {}),
|
||||
Redmine::MenuManager::MenuItem.new("test_child_unallowed", {:controller => 'issues', :action => 'unallowed'}, {}),
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
"test_child_allowed",
|
||||
{:controller => 'issues', :action => 'index'}, {}
|
||||
),
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
"test_child_unallowed",
|
||||
{:controller => 'issues', :action => 'unallowed'}, {}
|
||||
),
|
||||
]
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
)
|
||||
@output_buffer = render_menu_node(parent_node, Project.find(1))
|
||||
|
||||
assert_select("li") do
|
||||
@@ -225,12 +246,20 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
|
||||
|
||||
# parent with unallowed unattached child
|
||||
Redmine::MenuManager.map :menu2 do |menu|
|
||||
menu.push(:parent_node, nil,
|
||||
{:children => Proc.new {|p|
|
||||
[Redmine::MenuManager::MenuItem.new("test_child_unallowed",
|
||||
{:controller => 'issues',
|
||||
:action => 'new'}, {})]
|
||||
}})
|
||||
menu.push(
|
||||
:parent_node, nil,
|
||||
{
|
||||
:children =>
|
||||
Proc.new do |p|
|
||||
[
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
"test_child_unallowed",
|
||||
{:controller => 'issues', :action => 'new'}, {}
|
||||
)
|
||||
]
|
||||
end
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
# parent with unallowed standard child
|
||||
@@ -255,28 +284,34 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
|
||||
end
|
||||
|
||||
def test_render_menu_node_with_children_without_an_array
|
||||
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node,
|
||||
parent_node =
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
:parent_node,
|
||||
'/test',
|
||||
{
|
||||
:children => Proc.new {|p| Redmine::MenuManager::MenuItem.new("test_child", "/testing", {})}
|
||||
})
|
||||
|
||||
:children =>
|
||||
Proc.new do |p|
|
||||
Redmine::MenuManager::MenuItem.new("test_child", "/testing", {})
|
||||
end
|
||||
}
|
||||
)
|
||||
assert_raises Redmine::MenuManager::MenuError, ":children must be an array of MenuItems" do
|
||||
@output_buffer = render_menu_node(parent_node, Project.find(1))
|
||||
end
|
||||
end
|
||||
|
||||
def test_render_menu_node_with_incorrect_children
|
||||
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node,
|
||||
parent_node =
|
||||
Redmine::MenuManager::MenuItem.new(
|
||||
:parent_node,
|
||||
'/test',
|
||||
{
|
||||
:children => Proc.new {|p| ["a string"] }
|
||||
})
|
||||
|
||||
:children => Proc.new {|p| ["a string"]}
|
||||
}
|
||||
)
|
||||
assert_raises Redmine::MenuManager::MenuError, ":children must be an array of MenuItems" do
|
||||
@output_buffer = render_menu_node(parent_node, Project.find(1))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def test_menu_items_for_should_yield_all_items_if_passed_a_block
|
||||
|
||||
Reference in New Issue
Block a user