fix comment stream jasmine - bind function after spy has been defined
This commit is contained in:
parent
b3868fc6dd
commit
cd965e32fa
2 changed files with 9 additions and 4 deletions
|
|
@ -14,7 +14,11 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
this.model.comments.bind('add', this.appendComment, this);
|
this.model.comments.bind('add', this.appendComment, this);
|
||||||
this.commentTemplate = options.commentTemplate;
|
this.commentTemplate = options.commentTemplate;
|
||||||
|
|
||||||
this.model.bind("commentsExpanded", this.render, this)
|
this.setupBindings();
|
||||||
|
},
|
||||||
|
|
||||||
|
setupBindings: function() {
|
||||||
|
this.model.bind("commentsExpanded", this.render, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
postRenderTemplate : function() {
|
postRenderTemplate : function() {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,10 @@ describe("app.views.CommentStream", function(){
|
||||||
|
|
||||||
describe("binds", function() {
|
describe("binds", function() {
|
||||||
it("re-renders on a commentsExpanded trigger", function(){
|
it("re-renders on a commentsExpanded trigger", function(){
|
||||||
spyOn(this.view, "render")
|
spyOn(this.view, "render");
|
||||||
this.view.model.trigger("commentsExpanded")
|
this.view.setupBindings();
|
||||||
expect(this.view.render).toHaveBeenCalled()
|
this.view.model.trigger("commentsExpanded");
|
||||||
|
expect(this.view.render).toHaveBeenCalled();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue