describe("app.views.CommentStream", function(){ beforeEach(function(){ this.view = new app.views.CommentStream({model : factory.post()}) loginAs({}) }) describe("binds", function() { it("re-renders on a commentsExpanded trigger", function(){ spyOn(this.view, "render"); this.view.setupBindings(); this.view.model.trigger("commentsExpanded"); expect(this.view.render).toHaveBeenCalled(); }) }) describe("postRenderTemplate", function(){ it("applies infield labels", function(){ spyOn($.fn, "placeholder") this.view.postRenderTemplate() expect($.fn.placeholder).toHaveBeenCalled() expect($.fn.placeholder.mostRecentCall.object.selector).toBe("textarea") }) it("autoResizes the new comment textarea", function(){ spyOn($.fn, "autoResize") this.view.postRenderTemplate() expect($.fn.autoResize).toHaveBeenCalled() expect($.fn.autoResize.mostRecentCall.object.selector).toBe("textarea") }) }) describe("createComment", function(){ beforeEach(function(){ spyOn(this.view.model.comments, "create") }) it("clears the new comment textarea", function(){ var comment = { "id": 1234, "text": "hey", "author": "not_null" }; spyOn($, "ajax").andCallFake(function(params) { params.success(comment); }); $(this.view.el).html($("