added tests and typedoc

This commit is contained in:
lotte
2020-03-25 13:18:46 +01:00
committed by Art Lowel
parent e38aec831f
commit ef3a235178
36 changed files with 701 additions and 46 deletions

View File

@@ -13,6 +13,9 @@ import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
{ provide: NG_VALUE_ACCESSOR, useExisting: FileValueAccessorDirective, multi: true }
]
})
/**
* Value accessor directive for inputs of type 'file'
*/
export class FileValueAccessorDirective implements ControlValueAccessor {
value: any;
onChange = (_) => { /* empty */ };

View File

@@ -8,9 +8,12 @@ import {NG_VALIDATORS, Validator, FormControl} from '@angular/forms';
{ provide: NG_VALIDATORS, useExisting: FileValidator, multi: true },
]
})
/**
* Validator directive to validate if a file is selected
*/
export class FileValidator implements Validator {
static validate(c: FormControl): {[key: string]: any} {
return c.value == null || c.value.length === 0 ? { required : true} : null;
return c.value == null || c.value.length === 0 ? { required : true } : null;
}
validate(c: FormControl): {[key: string]: any} {