From 82d2b78b96580f45aef84ed15c7112588dde628f Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 14 May 2013 18:23:02 -0400 Subject: [PATCH] update jasmine tests --- .../spec/discussion/content_spec.coffee | 12 +++++--- .../view/discussion_content_view_spec.coffee | 30 +++++++++++++++---- .../response_comment_show_view_spec.coffee | 4 +-- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/common/static/coffee/spec/discussion/content_spec.coffee b/common/static/coffee/spec/discussion/content_spec.coffee index 841602ac2d..3a7cc35677 100644 --- a/common/static/coffee/spec/discussion/content_spec.coffee +++ b/common/static/coffee/spec/discussion/content_spec.coffee @@ -37,12 +37,16 @@ describe 'All Content', -> expect(@content.get 'subscribed').toEqual true it 'can be flagged for abuse', -> - @content.flagAbuse - #temp_array = @content.get("abuse_flaggers") - #temp_array.push(window.user.get('id')) - #@content.set("abuse_flaggers",temp_array) + @content.flagAbuse() expect(@content.get 'abuse_flaggers').toEqual ['123', '567'] + it 'can be unflagged for abuse', -> + temp_array = [] + temp_array.push(window.user.get('id')) + @content.set("abuse_flaggers",temp_array) + @content.unflagAbuse() + expect(@content.get 'abuse_flaggers').toEqual [] + describe 'Comments', -> beforeEach -> @comment1 = new Comment {id: '123'} diff --git a/common/static/coffee/spec/discussion/view/discussion_content_view_spec.coffee b/common/static/coffee/spec/discussion/view/discussion_content_view_spec.coffee index 393afd2c9e..c5d0482ef1 100644 --- a/common/static/coffee/spec/discussion/view/discussion_content_view_spec.coffee +++ b/common/static/coffee/spec/discussion/view/discussion_content_view_spec.coffee @@ -1,8 +1,8 @@ -xdescribe "DiscussionContentView", -> +describe "DiscussionContentView", -> beforeEach -> setFixtures - ''' + """
@@ -19,10 +19,28 @@ xdescribe "DiscussionContentView", ->
Pin Thread
- ''' - @ + """ + @thread = new Thread { + id: '01234567', + user_id: '567', + course_id: 'mitX/999/test', + body: 'this is a thread', + created_at: '2013-04-03T20:08:39Z', + abuse_flaggers: ['123'] + roles: [] + } + @view = new DiscussionContentView({ model: @thread }) + + it 'defines the tag', -> + expect($('#jasmine-fixtures')).toExist + expect(@view.tagName).toBeDefined + expect(@view.el.tagName.toLowerCase()).toBe 'div' it "defines the class", -> # spyOn @content, 'initialize' - myView = new DiscussionContentView(new Content) - expect(myView.tagName).toBeDefined() + expect(@view.model).toBeDefined(); + + it 'is tied to the model', -> + expect(@view.model).toBeDefined(); + + \ No newline at end of file diff --git a/common/static/coffee/spec/discussion/view/response_comment_show_view_spec.coffee b/common/static/coffee/spec/discussion/view/response_comment_show_view_spec.coffee index 26c9c1530d..bcc36c3c46 100644 --- a/common/static/coffee/spec/discussion/view/response_comment_show_view_spec.coffee +++ b/common/static/coffee/spec/discussion/view/response_comment_show_view_spec.coffee @@ -48,6 +48,4 @@ describe 'ResponseCommentShowView', -> it 'produces the correct HTML', -> @view.render() - expect(@view.el.innerHTML).toContainHtml """ -