ember-changeset icon indicating copy to clipboard operation
ember-changeset copied to clipboard

Confirm validation does not work as expected.

Open sutharmonil opened this issue 5 years ago • 2 comments

3.8.0

Test Case

I have

Steps to reproduce

I have a validations file which validates user fields. One of these fields requires confirmation on entering. ssn: [ validatePresence({ presence: true, message: 'Please enter SSN' }), validateFormat({ regex: /^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/, allowBlank: false, message: 'Please enter a valid SSN' }) ], confirmSsn: validateConfirmation({ on: 'ssn' })

As seen above, confirmSsn will check with the ssn field.

Expected Behavior

I expect when the values are same the error message should not show up.

Actual Behavior

When I call this.changeSet.validate() it gives me an erorr saying Confirm ssn does not match ssn. But when I check the actual text box values both are exactly the same.

sutharmonil avatar Aug 13 '20 17:08 sutharmonil

@sutharmonil 👋 Lets see if we can fix it. Do you have a test case we can add to verify it isn't working. Something in unit/changeset-test.js...

snewcomer avatar Aug 22 '20 17:08 snewcomer

I am not sure how to provide a test case here. Also, this happens when the object comes in a second time from the DB to the UI for editing. Not sure if that is helpful though.

sutharmonil avatar Aug 24 '20 15:08 sutharmonil