[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:
bbcodrin
2018-05-15 15:21:38 +03:00
committed by Maurizio Vitale
parent db7d0b7c08
commit fd924c439a
3 changed files with 33 additions and 4 deletions

View File

@@ -44,6 +44,8 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
field: string;
format = '[{FROM} TO {TO}]';
validators: Validators;
ngOnInit(): void {
if (this.settings) {
@@ -51,13 +53,13 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
this.format = this.settings.format || '[{FROM} TO {TO}]';
}
const validators = Validators.compose([
this.validators = Validators.compose([
Validators.required,
Validators.pattern(/^-?(0|[1-9]\d*)?$/)
]);
this.from = new FormControl('', validators);
this.to = new FormControl('', validators);
this.from = new FormControl('', this.validators);
this.to = new FormControl('', this.validators);
this.form = new FormGroup({
from: this.from,