mercredi 27 décembre 2017

When attempting to test an html File object, it wont let me prepopulate it with a sample image?

I created Component I was wanting to test with Angular Dart's Framework.

When I create my test file, it seems though that I am having issues creating a sample file to test against.

In my hirerarchy, I have:

./bird.jpg
./image_uploader_po.dart
./image_uploaders_test.dart

and then in the code I have

test("testing against valid image upload", () async {
  File testImage = new File("./bird.jpg");  //improper constructor.
  fixture.update((Component com){
    com.imageFile = testImage;
  });
  uploaderPO = await fixture.resolvePageObject(Component);
});

The issue I have is that this is not the dart/io implementation of File, but instead the Html Implementation.

I was trying to determine what the best course of action would be for this, to open a file for read access to apply to the Component's implementation of File.

I was looking up filereader, but that relates to a file which exists, which is what I am having issues with.

Right now, File constructor is: File(List<Object> fileBits, String filename, [Map<String, Dynamic> options]); and ultimately didn't know what "fileBits" should be.

You can find the File Class I am using at: http://ift.tt/2CaJVQF

My desired end state is to use a sample image file to apply it to an Image Uploader Component.

Thank you.

Aucun commentaire:

Enregistrer un commentaire