Skip to content

Commit ff2b53d

Browse files
author
Marc Antwertinger
committed
Fix validation indicator to only show for presence validations
The required field indicator (*) was shown for any validation (format, length, etc.). Now it correctly only appears when a presence validation is defined, matching the standard UX expectation that * means "required". (cherry picked from commit c948db7)
1 parent 266433c commit ff2b53d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/components/alchemy/ingredients/base_editor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def ingredient_role
178178
content = "#{icon} #{content}".html_safe
179179
end
180180

181-
if ingredient.has_validations?
181+
if presence_validation?
182182
"#{content}<span class='validation_indicator'>*</span>".html_safe
183183
else
184184
content

spec/components/alchemy/ingredients/base_editor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
end
187187

188188
it "does not show any validation indicator" do
189-
is_expected.to have_selector(".validation_indicator")
189+
is_expected.to_not have_selector(".validation_indicator")
190190
end
191191
end
192192
end

0 commit comments

Comments
 (0)