mardi 23 octobre 2018

Angular 6 FileReader Onload Testing

I am new to Angular and currently working with testing my Angular app. I have a method like this in my ts file

  selectVideo($event: any) {
        var reader = new FileReader();
            reader.onload = ($event: any) => {
                this.video = $event.target.result;
                this.HasVideo = true;
            }
        reader.readAsDataURL($event.target.files[0]);
    }

The HTML looks like this:

<input type="file" class="mediaUploader" (change)="selectVideo($event)">

I want to test the reader onload function. How can I do this ? Kindly help

Aucun commentaire:

Enregistrer un commentaire