Skip to content

Commit

Permalink
Added FR zip code validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzzz committed Oct 21, 2014
1 parent 110da0a commit ad178b0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/spec/validator/zipCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('zipCode', function() {
'<option value="SE">Sweden</option>',
'<option value="SK">Slovakia</option>',
'<option value="GB">United Kingdom</option>',
'<option value="FR">France</option>',
'</select>',
'</div>',
'</div>',
Expand Down Expand Up @@ -248,4 +249,27 @@ describe('zipCode', function() {
expect(this.bv.isValid()).toEqual(false);
}
});

it('France postal code', function() {
this.bv.updateOption('zc', 'zipCode', 'country', 'FR');

// Valid samples
var validSamples = ['12340', '01230', '75116'];
for (var i in validSamples) {
this.bv.resetForm();
this.$zipCode.val(validSamples[i]);
this.bv.validate();
expect(this.bv.isValid()).toBeTruthy();
}

// Invalid samples
var invalidSamples = ['123 45', '12 345', '123456', '1 2345', '1234 5', '12 3 45', '1234A'];
for (i in invalidSamples) {
this.bv.resetForm();
this.$zipCode.val(invalidSamples[i]);
this.bv.validate();
expect(this.bv.isValid()).toEqual(false);
}
});

});

0 comments on commit ad178b0

Please sign in to comment.