Skip to content

Commit

Permalink
add Hex validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dszymczuk committed Aug 27, 2017
1 parent 2f34193 commit b46d170
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/qunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,30 @@
});
});

test("Color Hex validation", function() {

clearForm();

var links = [
{val: '#0000FF', isValid: true},
{val: '#00F', isValid: true},
{val: '123', isValid: false},
{val: '112233', isValid: false},
{val: '#4567', isValid: false},
{val: input('transparent', {'allow-transparent': 'true'}), isValid: true},
{val: 'transparent', isValid: false}
];

$.each(links, function(i, obj) {
runTest(obj, 'hex');
});
});

// TODO: Write more tests...
}

$.validate({
modules : 'security, location, sweden, file, date, sanitize, uk, poland',
modules : 'security, location, sweden, file, date, sanitize, uk, poland, color',
onModulesLoaded: function( $form ) {
if( window.console && window.console.log )
console.log('About to run all tests');
Expand Down

0 comments on commit b46d170

Please sign in to comment.