feat(forms): add email validator (#13709)
Closes #13706 PR Close #13709
This commit is contained in:

committed by
Miško Hevery

parent
00979838ef
commit
d69717cf79
@ -64,6 +64,14 @@ export function main() {
|
||||
() => expect(Validators.requiredTrue(new FormControl(true))).toBeNull());
|
||||
});
|
||||
|
||||
describe('email', () => {
|
||||
it('should error on invalid email',
|
||||
() => expect(Validators.email(new FormControl('some text'))).toEqual({'email': true}));
|
||||
|
||||
it('should not error on valid email',
|
||||
() => expect(Validators.email(new FormControl('test@gmail.com'))).toBeNull());
|
||||
});
|
||||
|
||||
describe('minLength', () => {
|
||||
it('should not error on an empty string',
|
||||
() => { expect(Validators.minLength(2)(new FormControl(''))).toBeNull(); });
|
||||
|
Reference in New Issue
Block a user