Skip to content

Commit

Permalink
added test for numericality regex fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkessler committed Oct 27, 2011
1 parent 8e518b2 commit c8060c0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/javascript/public/test/validators/numericality.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ test('when only allowing integers and value is integer', function() {
equal(ClientSideValidations.validators.local.numericality(element, options), undefined);
});

test('when only allowing integers and value has a negative or positive sign', function() {
var element = $('<input type="text" />');
var options = { messages: { only_integer: "failed validation"}, only_integer: true };
element.val('-23');
equal(ClientSideValidations.validators.local.numericality(element, options), undefined);
element.val('+23');
equal(ClientSideValidations.validators.local.numericality(element, options), undefined);
});

test('when only allowing integers and value is not integer', function() {
var element = $('<input type="text" />');
var options = { messages: { only_integer: "failed validation" }, only_integer: true };
Expand Down

0 comments on commit c8060c0

Please sign in to comment.