Hello everyone,
I try to unit test this validator and I wonder to to give a value to the
AbstractControl. Thanks for your precious help.
My validator
export class VerifierNombresValidator {
static plage(min: number, max: number): ValidatorFn {
return (c: AbstractControl): { [key: string]: boolean } | null => {
if ((c.value) && c.value >= min && c.value <= max) {
return null;
}
return { 'plage': true };
};
}
}
My unit test (but not working) :
it('plage pour la valeur 3', () => {
let validatorFn = VerifierNombresValidator.apply(88);
let control = { value: '6' }
VerifierNombresValidator.arguments(control as AbstractControl);
let result = VerifierNombresValidator.plage(1,5);
expect(result['plage']).toBeUndefined();
});
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.