Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should pass.', () => {
let userFormGroup = formbuilder.group({
firstName: ['@ja', RxwebValidators.alpha({ conditionalExpression: (x) => x.firstName == "@jay" })]
})
userFormGroup.controls.firstName.setValue('@jay');
expect(userFormGroup.controls.firstName.errors).toEqual({ 'alpha': { message: 'Only alphabets are allowed.', refValues: ['@jay'] } });
})
() => {
expect(RxwebValidators.alpha()(new FormControl('Bharat'))).toBeNull();
});
() => {
expect(RxwebValidators.alpha()(new FormControl(undefined))).toBeNull();
});
//end
() => {
expect(RxwebValidators.compose({
validators: [RxwebValidators.alpha()]
})(new FormControl("India@"))).toEqual({ 'alpha': { message: 'only alphabets are allowed.', refValues: ['India@'] } })
});
ngOnInit() {
this.addressInfoFormGroup = this.formBuilder.group({
stateName:['', RxwebValidators.alpha({allowWhiteSpace:true })],
});
}
}
ngOnInit() {
this.countryFormGroup = this.formBuilder.group({
countryName:['', RxwebValidators.alpha()],
});
}
}
ngOnInit() {
this.userFormGroup = this.formBuilder.group({
userName:['', RxwebValidators.required()],
password : ['',[RxwebValidators.alpha(),RxwebValidators.password({ validation: { maxLength: 10, minLength: 5, digit: true, specialCharacter: true } })]],
});
}
}
ngOnInit() {
this.addressInfoFormGroup = this.formBuilder.group({
stateCode:['', RxwebValidators.alpha({message:'You can enter only alphabets.' })],
});
}
}
ngOnInit() {
this.addressInfoFormGroup = this.formBuilder.group({
countryName:['', RxwebValidators.alpha()],
countryCode:['', RxwebValidators.alpha({conditionalExpression:(x,y) => x.countryName == "India" })],
cityName:['', RxwebValidators.alpha({conditionalExpression:'x => x.countryName =="India"' })],
stateName:['', RxwebValidators.alpha({allowWhiteSpace:true })],
stateCode:['', RxwebValidators.alpha({message:'You can enter only alphabets.' })],
});
}
}
ngOnInit() {
this.addressInfoFormGroup = this.formBuilder.group({
stateCode:['', RxwebValidators.alpha({message:'You can enter only alphabets.' })],
});
}
}