Fixed bug #697: Remote validation uses wrong error messages #1028

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

@denisson
denisson commented Mar 4, 2014

This change doesn't break any existing unit test, but there is no additional tests. It would be great if somebody could create these tests, because I don't know how to do it.

@jzaefferer jzaefferer added this to the 1.14.0 milestone Sep 23, 2014
@jzaefferer jzaefferer added the Remote label Feb 17, 2015
@Arkni
Arkni commented Nov 8, 2015

@denisson
You can add this unit test (which fails without your fix) to your PR:

test( "Fix #697: remote validation uses wrong error messages", function( assert ) {
    var e = $( "#username" ),
        done1 = assert.async(),
        done2 = assert.async(),
        done3 = assert.async(),
        v = $( "#userForm" ).validate( {
            rules: {
                username: {
                    required: true,
                    remote: {
                        url: "users.php"
                    }
                }
            },
            messages: {
                username: {
                    remote: $.validator.format( "{0} in use" )
                }
            }
        } );

    $( "#userForm" ).valid();

    e.val( "Peter" );
    v.element( e );
    setTimeout( function() {
        equal( v.errorList[ 0 ].message, "Peter in use" );
        done1();

        e.val( "something" );
        v.element( e );

        e.val( "Peter" );
        v.element( e );
        setTimeout( function() {
            equal( v.errorList[ 0 ].message, "Peter in use" );
            done2();

            e.val( "asdf" );
            v.element( e );
            setTimeout( function() {
                equal( v.errorList[ 0 ].message, "asdf in use", "error message should be updated" );
                done3();
            } );
        } );
    } );
} );
NB: You should also rebase the PR on top of upstream/master
@staabm
Collaborator
staabm commented Nov 9, 2015

@denisson please adjust the commit message so it starts with Core: and add the test @Arkni provided

@Arkni
Arkni commented Nov 24, 2015

@denisson
Did you find the time to add the unit test ?

@denisson

@Arkni
Sorry. I was on vacation, but I will try to do it today.
Thanks for your help!

@Arkni
Arkni commented Dec 22, 2015

@denisson any update on this?

@denisson

I am having problems with commitplease. I guess I'm doing something wrong.
I will try again.

On Tue, Dec 22, 2015 at 11:25 AM, Brahim Arkni notifications@github.com
wrote:

@denisson https://github.com/denisson any update on this?


Reply to this email directly or view it on GitHub
#1028 (comment)
.

@Arkni
Arkni commented Dec 22, 2015

You have to start your commit message with Core:, something like:

Core: Remote validation uses wrong error messages

Fixes #697
@staabm staabm added a commit that closed this pull request Jan 7, 2016
@denisson denisson Core: Remote validation uses wrong error messages
Fixes #697. Closes #1028.
908b3f3
@staabm staabm closed this in 908b3f3 Jan 7, 2016
@staabm
Collaborator
staabm commented Jan 7, 2016

@denisson thx. rebased your change and landed it in master.

@Arkni thx for the test, added it after rebase.

@RobJohnston RobJohnston added a commit to RobJohnston/jquery-validation that referenced this pull request Mar 6, 2016
@denisson denisson Core: Remote validation uses wrong error messages
Fixes #697. Closes #1028.
1572de7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment