I am using jasmine 2.0 for testing javascript functions. I have backbone code which is written below.
events:{
"click #div1":"div1Clicked"
}
div1Clicked:function(){
onComplete = function(){
some functionality
};
onComplete();
}
I have written test case with jasmin which looks like following:
describe('View : Test View', function() {
beforeEach(function(){
testView = new View();
});
describe('div1Clicked',function(){
it('Should call div1Clicked',function(){
spyOn(testView,'div1Clicked').and.callThrough();
testView.div1Clicked();
expect(testView.div1Clicked).toHaveBeenCalled();
});
});
});
How to write test case for onComplete inside div1Clicked function?