Skip to content

Commit

Permalink
Merge pull request DavyJonesLocker#466 from romanbsd/3-2-stable
Browse files Browse the repository at this point in the history
jQuery 1.9 compatibility, use .prop('checked')
  • Loading branch information
bcardarella committed Jan 23, 2013
2 parents 29a6e49 + 7cea9f2 commit bf8f982
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion coffeescript/rails.validations.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ window.ClientSideValidations.validators =
acceptance: (element, options) ->
switch element.attr('type')
when 'checkbox'
unless element.attr('checked')
unless element.prop('checked')
return options.message
when 'text'
if element.val() != (options.accept?.toString() || '1')
Expand Down
2 changes: 1 addition & 1 deletion test/javascript/public/test/validateElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test('Validate when checkbox is clicked', function() {
var form = $('form#new_user'), input = form.find('input#user_agree');
var label = $('label[for="user_agree"]');

input.attr('checked', false)
input.prop('checked', false)
input.trigger('click');
ok(input.parent().hasClass('field_with_errors'));
ok(label.parent().hasClass('field_with_errors'));
Expand Down
2 changes: 1 addition & 1 deletion test/javascript/public/test/validators/acceptance.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module('Acceptance options');
test('when checkbox and checked', function() {
var element = $('<input type="checkbox" />');
var options = { message: "failed validation" };
element.attr('checked', true)
element.prop('checked', true)
equal(ClientSideValidations.validators.local.acceptance(element, options), undefined);
});

Expand Down
2 changes: 1 addition & 1 deletion vendor/assets/javascripts/rails.validations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf8f982

Please sign in to comment.