Project

General

Profile

Feature #43087 » test-for-43087.patch

Marius BĂLTEANU, 2026-02-03 03:04

View differences:

test/helpers/icons_helper_test.rb
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{<svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/themes/test/icons.svg#icon--edit"></use></svg>$}
assert_match expected, sprite_icon('edit')
end
end
(3-3/4)