fix menu helper tests

pull/1186/head
Martin Linkhorst 12 years ago
parent d1e0c6d971
commit 4d2dd08289
  1. 1
      lib/redmine/menu_manager/menu_helper.rb
  2. 15
      test/unit/lib/redmine/menu_manager/menu_helper_test.rb

@ -14,6 +14,7 @@
module Redmine::MenuManager::MenuHelper
include TopMenuHelper
include AccessibilityHelper
# Returns the current menu item name
def current_menu_item

@ -59,14 +59,16 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
node = Redmine::MenuManager::MenuItem.new(:testing, '/test', { })
@response.body = render_single_menu_node(node, 'This is a test', node.url, false)
assert_select("a.testing", "This is a test")
html_node = HTML::Document.new(@response.body)
assert_select(html_node.root, "a.testing", "This is a test")
end
def test_render_menu_node
single_node = Redmine::MenuManager::MenuItem.new(:single_node, '/test', { })
@response.body = render_menu_node(single_node, nil)
assert_select("li") do
html_node = HTML::Document.new(@response.body)
assert_select(html_node.root, "li") do
assert_select("a.single-node", "Single node")
end
end
@ -81,7 +83,8 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
@response.body = render_menu_node(parent_node, nil)
assert_select("li") do
html_node = HTML::Document.new(@response.body)
assert_select(html_node.root, "li") do
assert_select("a.parent-node", "Parent node")
assert_select("ul") do
assert_select("li a.child-one-node", "Child one node")
@ -115,7 +118,8 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
})
@response.body = render_menu_node(parent_node, Project.find(1))
assert_select("li") do
html_node = HTML::Document.new(@response.body)
assert_select(html_node.root, "li") do
assert_select("a.parent-node", "Parent node")
assert_select("ul") do
assert_select("li a.test-child-0", "Test child 0")
@ -154,7 +158,8 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
@response.body = render_menu_node(parent_node, Project.find(1))
assert_select("li") do
html_node = HTML::Document.new(@response.body)
assert_select(html_node.root, "li") do
assert_select("a.parent-node", "Parent node")
assert_select("ul") do
assert_select("li a.child-node", "Child node")

Loading…
Cancel
Save