Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

denisson
Copy link
Contributor

@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.

@Arkni
Copy link
Member

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
Copy link
Member

staabm commented Nov 9, 2015

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

@Arkni
Copy link
Member

Arkni commented Nov 24, 2015

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

@denisson
Copy link
Contributor Author

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

@Arkni
Copy link
Member

Arkni commented Dec 22, 2015

@denisson any update on this?

@denisson
Copy link
Contributor Author

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
Copy link
Member

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 closed this in 908b3f3 Jan 7, 2016
@staabm
Copy link
Member

staabm commented Jan 7, 2016

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy