Skip to content

Commit

Permalink
Add element to success call with test. Fixes jquery-validation#60
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch authored and jzaefferer committed May 7, 2012
1 parent 851e941 commit a856823
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jquery.validate.js
Expand Up @@ -703,7 +703,7 @@ $.extend($.validator, {
if ( typeof this.settings.success === "string" ) {
label.addClass( this.settings.success );
} else {
this.settings.success( label );
this.settings.success( label, element );
}
}
this.toShow = this.toShow.add(label);
Expand Down
11 changes: 11 additions & 0 deletions test/test.js
Expand Up @@ -875,6 +875,17 @@ test("success isn't called for optional elements", function() {
equal( 0, $("#testForm1 label").size() );
});

test("success callback with element", function() {
expect(1);
var v = $("#userForm").validate({
success: function( label, element ) {
equal( element, $('#username').get(0) );
}
});
$("#username").val("hi");
v.form();
});

test("all rules are evaluated even if one returns a dependency-mistmatch", function() {
expect(6);
equal( "", $("#firstname").removeClass().val() );
Expand Down

0 comments on commit a856823

Please sign in to comment.