describe "CMS.Views.SectionShow", -> describe "Basic", -> beforeEach -> spyOn(CMS.Views.SectionShow.prototype, "switchToEditView") .andCallThrough() @model = new CMS.Models.Section({ id: 42 name: "Life, the Universe, and Everything" }) @view = new CMS.Views.SectionShow({model: @model}) @view.render() it "should contain the model name", -> expect(@view.$el).toHaveText(@model.get('name')) it "should call switchToEditView when clicked", -> @view.$el.click() expect(@view.switchToEditView).toHaveBeenCalled() it "should pass the same element to SectionEdit when switching views", -> spyOn(CMS.Views.SectionEdit.prototype, 'initialize').andCallThrough() @view.switchToEditView() expect(CMS.Views.SectionEdit.prototype.initialize).toHaveBeenCalled() expect(CMS.Views.SectionEdit.prototype.initialize.mostRecentCall.args[0].el).toEqual(@view.el) describe "CMS.Views.SectionEdit", -> describe "Basic", -> tpl = readFixtures('section-name-edit.underscore') feedback_tpl = readFixtures('system-feedback.underscore') beforeEach -> setFixtures($("