commit a4e6fc5b77b011148209bb3ecc61550d440d0419 Author: Marius BĂLTEANU Date: Tue Feb 3 08:50:05 2026 +0700 Allow active theme to override default icons by providing an icons.svg in their theme (#43087). diff --git a/test/helpers/icons_helper_test.rb b/test/helpers/icons_helper_test.rb index 7ef071f86..21febc58c 100644 --- a/test/helpers/icons_helper_test.rb +++ b/test/helpers/icons_helper_test.rb @@ -132,4 +132,37 @@ class IconsHelperTest < Redmine::HelperTest def test_icon_for_mime_type_should_return_generic_file_icon_for_unknown_mime_types assert_equal 'file', icon_for_mime_type('unknown-type') end + + def test_sprite_source_without_theme_should_return_default_sprite + stubs(:current_theme).returns(nil) + + assert_equal "icons.svg", sprite_source + end + + def test_sprite_source_with_theme_and_sprite_image_should_return_theme_path + theme = mock('theme') + theme.stubs(:images).returns(['icons.svg']) + theme.stubs(:image_path).with('icons.svg').returns('themes/test/icons.svg') + stubs(:current_theme).returns(theme) + + assert_equal "themes/test/icons.svg", sprite_source + end + + def test_sprite_source_with_theme_without_sprite_image_should_return_default_sprite + theme = mock('theme') + theme.stubs(:images).returns([]) + stubs(:current_theme).returns(theme) + + assert_equal "icons.svg", sprite_source + end + + def test_sprite_icon_with_theme_override_should_use_theme_sprite + theme = mock('theme') + theme.stubs(:images).returns(['icons.svg']) + theme.stubs(:image_path).with('icons.svg').returns('themes/test/icons.svg') + stubs(:current_theme).returns(theme) + + expected = %r{$} + assert_match expected, sprite_icon('edit') + end end