Adding tests for file select directive
This commit is contained in:
@@ -4,30 +4,30 @@ import { FileUploader } from './file-uploader.class';
|
||||
|
||||
// todo: filters
|
||||
|
||||
@Directive({selector: '[ng2FileSelect]'})
|
||||
@Directive({ selector: '[ng2FileSelect]' })
|
||||
export class FileSelectDirective {
|
||||
@Input() public uploader:FileUploader;
|
||||
@Input() public uploader: FileUploader;
|
||||
|
||||
protected element:ElementRef;
|
||||
protected element: ElementRef;
|
||||
|
||||
public constructor(element:ElementRef) {
|
||||
public constructor(element: ElementRef) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
public getOptions():any {
|
||||
public getOptions(): any {
|
||||
return this.uploader.options;
|
||||
}
|
||||
|
||||
public getFilters():any {
|
||||
return void 0;
|
||||
public getFilters(): any {
|
||||
return {};
|
||||
}
|
||||
|
||||
public isEmptyAfterSelection():boolean {
|
||||
public isEmptyAfterSelection(): boolean {
|
||||
return !!this.element.nativeElement.attributes.multiple;
|
||||
}
|
||||
|
||||
@HostListener('change')
|
||||
public onChange():any {
|
||||
public onChange(): any {
|
||||
// let files = this.uploader.isHTML5 ? this.element.nativeElement[0].files : this.element.nativeElement[0];
|
||||
let files = this.element.nativeElement.files;
|
||||
let options = this.getOptions();
|
||||
|
||||
Reference in New Issue
Block a user