Fix SSO icon rendering for mixed-case provider icons (#1674)

* fix(sso): normalize icon names and fail gracefully

* fix(sso): fall back to key icon

---------

Co-authored-by: SureBot <sure-bot@we-promise.com>
This commit is contained in:
Sure Admin (bot)
2026-05-05 11:52:40 +02:00
committed by GitHub
parent c294cbf54b
commit 1646abb938
2 changed files with 52 additions and 3 deletions

View File

@@ -1,6 +1,39 @@
require "test_helper"
class ApplicationHelperTest < ActionView::TestCase
test "#icon normalizes icon names to lowercase" do
capture = []
singleton_class.send(:define_method, :lucide_icon) do |key, **opts|
capture << [ key, opts ]
"<svg></svg>".html_safe
end
icon("Key")
assert_equal "key", capture.first.first
ensure
singleton_class.send(:remove_method, :lucide_icon) if singleton_class.method_defined?(:lucide_icon)
end
test "#icon falls back when lucide icon is unknown" do
calls = []
singleton_class.send(:define_method, :lucide_icon) do |key, **_opts|
calls << key
raise ArgumentError, "Unknown icon #{key}" if key == "not-a-real-icon"
"<svg></svg>".html_safe
end
result = icon("not-a-real-icon")
assert_equal [ "not-a-real-icon", "key" ], calls
assert_equal "<svg></svg>", result
ensure
singleton_class.send(:remove_method, :lucide_icon) if singleton_class.method_defined?(:lucide_icon)
end
test "#title(page_title)" do
title("Test Title")
assert_equal "Test Title", content_for(:title)