How to test file upload with Jasmine BDD

荒凉一梦 提交于 2020-01-01 10:29:08

问题


I'm using jQuery file upload plugin for managing image file uploads. What will be the right way to test image submission with Jasmine.


回答1:


I would take a look at using the helper library Sinon.js. You can mock the XMLHttpRequest object to intercept the post request, and verify that your plugin code is submitting images correctly. In particular, take a look at this part of the Sinon.js documentation:

http://sinonjs.org/docs/#server



来源:https://stackoverflow.com/questions/10673001/how-to-test-file-upload-with-jasmine-bdd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!