Jasmine tests of validation utility

Includes a modification of validation logic which performs min and max length checks on optional fields in addition to required fields.
Merge pull request #5877 from edx/renzo/test-validation-utility

Jasmine tests of validation utility