FIX: Show validation error on confirmation user fields (#30232)

* FIX: Show validation error on confirmation user fields

* test
This commit is contained in:
Jan Cernik 2024-12-12 18:45:28 -03:00 committed by GitHub
parent c3e7d97048
commit 96417592a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View File

@ -19,4 +19,8 @@
>*</span>{{/if}}{{/unless}}
</span>
</label>
<InputTip
@validation={{@validation}}
class={{unless @validation.reason "hidden"}}
/>
</div>

View File

@ -36,9 +36,13 @@ export default Mixin.create({
userField.field.required &&
(!userField.value || isEmpty(userField.value))
) {
const reasonKey =
userField.field.field_type === "confirm"
? "user_fields.required_checkbox"
: "user_fields.required";
validation = EmberObject.create({
failed: true,
reason: i18n("user_fields.required", {
reason: i18n(reasonKey, {
name: userField.field.name,
}),
element: userField.field.element,

View File

@ -104,6 +104,10 @@ acceptance("Create Account - User Fields", function (needs) {
.dom(".user-field-what-is-your-pets-name .tip.bad")
.exists("shows required field error");
assert
.dom(".user-field-ive-read-the-terms-of-service .tip.bad")
.exists("shows required field error");
assert
.dom(".user-field-whats-your-dad-like .tip.bad")
.exists("shows same as password error");

View File

@ -1212,7 +1212,8 @@ en:
user_fields:
none: "(select an option)"
required: 'Please enter a value for "%{name}"'
same_as_password: "Your password should not be repeated in other fields."
required_checkbox: 'The field "%{name}" is required'
same_as_password: "Your password should not be repeated in other fields"
optional: (optional)
user: