define ["js/models/section", "js/views/section_show", "js/views/section_edit", "sinon"], (Section, SectionShow, SectionEdit, sinon) -> describe "SectionShow", -> describe "Basic", -> beforeEach -> spyOn(SectionShow.prototype, "switchToEditView") .andCallThrough() @model = new Section({ id: 42 name: "Life, the Universe, and Everything" }) @view = new 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(SectionEdit.prototype, 'initialize').andCallThrough() @view.switchToEditView() expect(SectionEdit.prototype.initialize).toHaveBeenCalled() expect(SectionEdit.prototype.initialize.mostRecentCall.args[0].el).toEqual(@view.el) describe "SectionEdit", -> describe "Basic", -> tpl = readFixtures('section-name-edit.underscore') feedback_tpl = readFixtures('system-feedback.underscore') beforeEach -> setFixtures($("