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
And what about this one?
beforeEach(function() {
// spyOn(XMLHttpRequest.prototype, 'open').andCallThrough(); // Jasmine 1.x
spyOn(XMLHttpRequest.prototype, 'open').and.callThrough(); // Jasmine 2.x
spyOn(XMLHttpRequest.prototype, 'send');
});
...
it("should call proper YQL! API", function() {
podcast.load_feed('http://www.faif.us/feeds/cast-ogg/');
expect(XMLHttpRequest.prototype.open).toHaveBeenCalled();
});
Pure Jasmine without need to use any external library.