mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2925] Required and invalid validators added (#3277)
* test added * tests clean * test added * tslint clean * test name changed * update tests
This commit is contained in:
committed by
Maurizio Vitale
parent
db7d0b7c08
commit
fd924c439a
@@ -136,4 +136,28 @@ describe('SearchNumberRangeComponent', () => {
|
||||
|
||||
expect(component.formValidator).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should throw pattern error if "from" value is formed by letters', () => {
|
||||
component.ngOnInit();
|
||||
component.from = new FormControl('abc', component.validators);
|
||||
expect(component.from.hasError('pattern')).toBe(true);
|
||||
});
|
||||
|
||||
it('should not throw pattern error if "from" value is formed by digits', () => {
|
||||
component.ngOnInit();
|
||||
component.from = new FormControl(123, component.validators);
|
||||
expect(component.from.hasError('pattern')).toBe(false);
|
||||
});
|
||||
|
||||
it('should throw required error if "from" value is empty', () => {
|
||||
component.ngOnInit();
|
||||
component.from = new FormControl('', component.validators);
|
||||
expect(component.from.hasError('required')).toBe(true);
|
||||
});
|
||||
|
||||
it('should not throw required error if "from" value is not empty', () => {
|
||||
component.ngOnInit();
|
||||
component.from = new FormControl(123, component.validators);
|
||||
expect(component.from.hasError('required')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user