How to test XMLHttpRequest with Jasmine

后端 未结 6 1123
心在旅途
心在旅途 2021-02-19 16:43

How can I test the onreadystatechange on XMLHttpRequest or pure Javascript AJAX without jQuery? I\'m doing this because I\'m developing Firefox extension. I guess I have to use

6条回答
  •  感动是毒
    2021-02-19 17:09

    As mention in the comments with SinonJS you can easily mock the XHR object / create a fake server.

提交回复
热议问题