Oops, fix test failures

This commit is contained in:
Daniel Waterworth 2023-03-17 16:46:36 -05:00
parent 7415671fd1
commit 50318cf5e9
2 changed files with 6 additions and 5 deletions

View File

@ -318,6 +318,7 @@ module SvgSprite
"Bad XML in custom sprite in theme with ID=#{theme_id}. Error info: #{e.inspect}",
)
end
symbols
end
end
@ -397,8 +398,8 @@ License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL
symbols = svgs_for(SiteSetting.default_theme_id)
symbols.slice!(*icons) if only_available
symbols.delete_if! { |icon_id, sym| !icon_id.include?(keyword) } unless keyword.empty?
symbols.sort_by(&:first).map(&:second)
symbols.reject! { |icon_id, sym| !icon_id.include?(keyword) } unless keyword.empty?
symbols.sort_by(&:first).map { |icon_id, symbol| { id: icon_id, symbol: symbol } }
end
# For use in no_ember .html.erb layouts

View File

@ -612,7 +612,7 @@ HTML
describe "SVG sprite theme fields" do
let :svg_content do
"<svg></svg>"
"<svg><symbol id='test'></symbol></svg>"
end
let :upload_file do
@ -651,10 +651,10 @@ HTML
it "clears SVG sprite cache when upload is deleted" do
theme_field
expect(SvgSprite.custom_svg_sprites(theme.id).size).to eq(1)
expect(SvgSprite.custom_svgs(theme.id).size).to eq(1)
theme_field.destroy!
expect(SvgSprite.custom_svg_sprites(theme.id).size).to eq(0)
expect(SvgSprite.custom_svgs(theme.id).size).to eq(0)
end
it "crashes gracefully when svg is invalid" do