I am trying to test a button click using backbone.js, jasmine.js and sinon.js. But the following test case fails. I am using a spy to track whether it is getting called or n
events:{
"click" : "addTask"
},
means that you are binding the click event to this.el - root element of the view which in your case have an ID new_task_section. You need to bind it to #add_new_task which is your 'add task' button I assume - this should fix it!
events:{
"click #add_new_task" : "addTask"
},
Update:
$("#add_new_task") won't find the element as the view isn't added to the document DOM tree. use this.view.$('#add_new_task') and it should work as it will search for the element in the detached fragment stored in the view.