fix(forms): introduce checkbox required validator

Closes #11459
Closes #13364
This commit is contained in:
Dzmitry Shylovich
2016-12-10 13:44:04 +03:00
committed by Victor Berchet
parent 7b0a86718c
commit 2bf1bbc071
8 changed files with 172 additions and 16 deletions

View File

@ -50,6 +50,14 @@ export function main() {
() => { expect(Validators.required(new FormControl(0))).toBeNull(); });
});
describe('requiredTrue', () => {
it('should error on false',
() => expect(Validators.requiredTrue(new FormControl(false))).toEqual({'required': true}));
it('should not error on true',
() => expect(Validators.requiredTrue(new FormControl(true))).toBeNull());
});
describe('minLength', () => {
it('should not error on an empty string',
() => { expect(Validators.minLength(2)(new FormControl(''))).toBeNull(); });