|
@@ -1,4 +1,6 @@
|
|
|
-// TESTS: Button callbacks in deeply nested forms, an validators on custom controls
|
|
|
+// ---------------------------------------------------------------------------------------------------------------------
|
|
|
+// TESTS: Button callbacks in deeply nested forms, and validators on custom controls
|
|
|
+// ---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
import { FormControl, Validators, ValidationErrors } from '@angular/forms';
|
|
|
|
|
@@ -7,7 +9,7 @@ import { Observable, of } from 'rxjs';
|
|
|
import { delay, map } from 'rxjs/internal/operators';
|
|
|
|
|
|
const testAsyncValidator = (fc: FormControl): Observable<ValidationErrors> => {
|
|
|
- return of(fc).pipe(delay(5000)).pipe(map(_fc => {
|
|
|
+ return of(fc).pipe(delay(2000)).pipe(map(_fc => {
|
|
|
console.log('Async validator got', _fc.value);
|
|
|
return _fc.value === '4200' ? null : { is4200: false };
|
|
|
}));
|
|
@@ -46,8 +48,8 @@ const meta = {
|
|
|
validatorTest: {
|
|
|
validators: [ Validators.required, Validators.minLength(4) ],
|
|
|
// perhaps have some standard messages for standard failures in the Object.prototype ??
|
|
|
- valFailureMessages: {
|
|
|
- 'required': 'This field is required',
|
|
|
+ valFailureMsgs: {
|
|
|
+ 'required': 'This field is simply a MUST',
|
|
|
'minlength': 'Please type something longer'
|
|
|
}
|
|
|
},
|
|
@@ -60,7 +62,7 @@ const meta = {
|
|
|
d: {
|
|
|
meta: {
|
|
|
isWorking: { type: 'radio', 'label': 'Does it work yet?', validators: Validators.required },
|
|
|
- f: { type: 'clrDatepicker' },
|
|
|
+ f: { type: 'datepicker' },
|
|
|
deeplyNestedButtonGroup: { type: 'buttonGroup', label: 'Deeply Nested Buttons',
|
|
|
meta: [
|
|
|
{ label: 'Say Hello', fnId: 'SAYHELLO' },
|