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>{{/if}}{{/unless}}
</span> </span>
</label> </label>
<InputTip
@validation={{@validation}}
class={{unless @validation.reason "hidden"}}
/>
</div> </div>

View File

@ -36,9 +36,13 @@ export default Mixin.create({
userField.field.required && userField.field.required &&
(!userField.value || isEmpty(userField.value)) (!userField.value || isEmpty(userField.value))
) { ) {
const reasonKey =
userField.field.field_type === "confirm"
? "user_fields.required_checkbox"
: "user_fields.required";
validation = EmberObject.create({ validation = EmberObject.create({
failed: true, failed: true,
reason: i18n("user_fields.required", { reason: i18n(reasonKey, {
name: userField.field.name, name: userField.field.name,
}), }),
element: userField.field.element, 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") .dom(".user-field-what-is-your-pets-name .tip.bad")
.exists("shows required field error"); .exists("shows required field error");
assert
.dom(".user-field-ive-read-the-terms-of-service .tip.bad")
.exists("shows required field error");
assert assert
.dom(".user-field-whats-your-dad-like .tip.bad") .dom(".user-field-whats-your-dad-like .tip.bad")
.exists("shows same as password error"); .exists("shows same as password error");

View File

@ -1212,7 +1212,8 @@ en:
user_fields: user_fields:
none: "(select an option)" none: "(select an option)"
required: 'Please enter a value for "%{name}"' 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) optional: (optional)
user: user: