180
rated 0 times
[
186]
[
6]
/ answers: 1 / hits: 18473
/ 11 Years ago, thu, april 11, 2013, 12:00:00
I recently added an e.preventDefault()
to one of my javascript functions and it broke my jasmine spec. I've tried spyOn(e, 'preventDefault').andReturn(true);
but I get e
is undefined error. How do I stub 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();
});
More From » jasmine