mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-14 20:35:47 +01:00
Core: Call to resetInternals removed in remote validation callback (#2242)
* Core: Call to resetInternals removed in remote validation callback * Core: Add unit test for issue #2150 fix * Core: fix code style errors Co-authored-by: leonardospina <leo@babieleo.it> Co-authored-by: Julien Tschäppät <julien.tschappat@smartliberty.ch>
This commit is contained in:
31
test/test.js
31
test/test.js
@@ -2060,6 +2060,37 @@ QUnit.test( "[Remote rule] #1508: Validation fails to trigger when next field is
|
||||
check( "abc" );
|
||||
} );
|
||||
|
||||
$.mockjax( {
|
||||
url: "issue2150TestForm.action",
|
||||
response: function() {
|
||||
this.responseText = "true";
|
||||
},
|
||||
responseTime: 1
|
||||
} );
|
||||
|
||||
QUnit.test( "Remote validation should not reset existing errors (#2150)", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
var done = assert.async();
|
||||
$( "#issue2150TestForm" ).validate( {
|
||||
rules: {
|
||||
remoteTestedInput: {
|
||||
remote: "issue2150TestForm.action"
|
||||
},
|
||||
requiredInput: "required"
|
||||
}
|
||||
} );
|
||||
|
||||
assert.equal( $( "#requiredInput" ).attr( "class" ), undefined, "#requiredInput should not have any class" );
|
||||
|
||||
var isValid = $( "#issue2150TestForm" ).valid();
|
||||
|
||||
setTimeout( function() {
|
||||
assert.equal( $( "#requiredInput" ).attr( "class" ), "error", "#requiredInput should have \"error\" class" );
|
||||
assert.equal( isValid, false, "Form should have error" );
|
||||
done();
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( "validate checkbox on click", function( assert ) {
|
||||
function errors( expected, message ) {
|
||||
assert.equal( v.size(), expected, message );
|
||||
|
||||
Reference in New Issue
Block a user