summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-11-10 15:54:34 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-11-10 15:54:34 +0000
commitd8fa577550c3773676c21344555b450feecd36cf (patch)
tree70be012495974ec36851064de501abc1cc1b0228 /test/unit
parent0f7e32107811195d16593db28b1d8859890b62f1 (diff)
downloadredmine-d8fa577550c3773676c21344555b450feecd36cf.tar.gz
redmine-d8fa577550c3773676c21344555b450feecd36cf.zip
Allows plugins to add custom SVG icons for menu items added by the plugin (#23980).
Patch by Takenori TAKAKI (user:takenory). git-svn-id: https://svn.redmine.org/redmine/trunk@23234 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/lib/redmine/menu_manager/menu_helper_test.rb11
-rw-r--r--test/unit/lib/redmine/menu_manager/menu_item_test.rb7
2 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
index 3d9570182..4b6151c9d 100644
--- a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
+++ b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
@@ -42,6 +42,17 @@ class Redmine::MenuManager::MenuHelperTest < Redmine::HelperTest
assert_select("a.testing", "This is a test")
end
+ def test_render_single_menu_node_with_plugin_icon
+ node = Redmine::MenuManager::MenuItem.new(:testing, '/test', { :icon => 'plugin_icon_name',:plugin => 'test_plugin_name' })
+ @output_buffer = render_single_menu_node(node, 'This is a test', node.url, false)
+
+ assert_select("a.testing", "This is a test") do
+ assert_select("svg.icon-svg") do
+ assert_select("use[href=?]", "/assets/plugin_assets/test_plugin_name/icons.svg#icon--plugin_icon_name")
+ end
+ end
+ end
+
def test_render_menu_node
single_node = Redmine::MenuManager::MenuItem.new(:single_node, '/test', {})
@output_buffer = render_menu_node(single_node, nil)
diff --git a/test/unit/lib/redmine/menu_manager/menu_item_test.rb b/test/unit/lib/redmine/menu_manager/menu_item_test.rb
index 12d6fa2f6..d5d9cdbde 100644
--- a/test/unit/lib/redmine/menu_manager/menu_item_test.rb
+++ b/test/unit/lib/redmine/menu_manager/menu_item_test.rb
@@ -102,6 +102,13 @@ class Redmine::MenuManager::MenuItemTest < ActiveSupport::TestCase
end
end
+ def test_new_menu_item_should_allow_setting_the_plugin
+ menu_item = Redmine::MenuManager::MenuItem.new(
+ :test_plugin_menu, '/test', {:plugin => 'test_plugin_name'}
+ )
+ assert_equal 'test_plugin_name', menu_item.plugin
+ end
+
def test_has_children
parent_item = get_menu_item(:test_menu, :parent)
assert parent_item.children.present?