From 47fdec5e2d2b4e1c16519639494d0ba4ffbabe31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Monn=C3=A9?= Date: Sat, 16 Jul 2022 10:22:53 +0200 Subject: [PATCH] Core: remove pending class from fields with an aborted request Ref #2434 Ref #2435 --- src/core.js | 1 + test/methods.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/core.js b/src/core.js index 923b3012b..b7c62c04c 100644 --- a/src/core.js +++ b/src/core.js @@ -1152,6 +1152,7 @@ $.extend( $.validator, { } delete this.pending[ element.name ]; + $( element ).removeClass( this.settings.pendingClass ); } }, diff --git a/test/methods.js b/test/methods.js index 2966ec25f..a65e4b474 100644 --- a/test/methods.js +++ b/test/methods.js @@ -822,11 +822,19 @@ QUnit.test( "Fix #2434: race condition in remote validation rules", function( as e.val( "Peter" ); v.element( e ); + assert.equal( e.hasClass( "error" ), false, "Field 'username' should not have the error class" ); + assert.equal( e.hasClass( "pending" ), true, "field 'username' should have the pending class" ); e.val( "" ); v.element( e ); + assert.equal( v.errorList[ 0 ].message, "This field is required." ); + assert.equal( e.hasClass( "error" ), true, "Field 'username' should have the error class" ); + assert.equal( e.hasClass( "pending" ), false, "field 'username' should not have the pending class" ); + setTimeout( function() { assert.equal( v.errorList[ 0 ].message, "This field is required." ); + assert.equal( e.hasClass( "error" ), true, "Field 'username' should have the error class" ); + assert.equal( e.hasClass( "pending" ), false, "field 'username' should not have the pending class" ); done1(); } ); } ); 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