I am using jasmine framework for testing the backbone.js view .I am creating instance of the view using following code:var listview = new employee_list_view(); in SpecRunner.html
and in my test.js file i have following code:
var employee_list_view = Backbone.View.extend({
el: $('#employee'),
model:Person,
initialize: function() {
this.collection.bind("add", this.render, this);
},
But after running the test cases I got following error:
TypeError: 'undefined' is not a constructor (evaluating 'new employee_list_view()')
I have tried lot but i ended with the same error.Is there any solution for this ?
Looks like you did not instantiate the view.
Do
var list_view = new employee_list_view({ collection: collection });