I recently added e.preventDefault() to one of my javascript functions, and it broke my jasmine specification. I tried spyOn(e, 'preventDefault').andReturn(true); but i get e undefined error. How to block e.preventDefault()?
showTopic: function(e) { e.preventDefault(); midParent.prototype.showTopic.call(this, this.model, popup); this.topic.render(); } it("calls the parent", function() { var parentSpy = spyOn(midParent.prototype, "showTopic"); this.view.topic = { render: function() {} }; this.view.showTopic(); expect(parentSpy).toHaveBeenCalled(); });
source share