Skip to Content
author's profile photo
Former Member

Qunit test for csv fileupload


Can someone help me out in how to write qunit test for csv file upload? I have three use cases - 1. read csv file succesfully 2. upload wrong type file 3. upload bad data csv file

This is the sample code i am using - csvfile upload link

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Posted on Mar 08, 2017 at 09:17 AM

    Unfortunately you cannot properly/fully test a file input with Qunit. The JavaScript APIs will not allow you to set the files to the input due to security restrictions. If JavaScript would be able to access any file on the users disk and apply it to such an input field, the area for misuse great.

    As a workaround you could directly call your callback functions and provide whatever input an event from the file input control would have given.

    To get more concrete ideas, check the Qunit tests written for the control:

    Add comment
    10|10000 characters needed characters exceeded