update jasmine tests

This commit is contained in:
Your Name
2013-05-14 18:23:02 -04:00
committed by Jay Zoldak
parent 71be3debc4
commit 82d2b78b96
3 changed files with 33 additions and 13 deletions

View File

@@ -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'}

View File

@@ -1,8 +1,8 @@
xdescribe "DiscussionContentView", ->
describe "DiscussionContentView", ->
beforeEach ->
setFixtures
'''
"""
<div class="discussion-post">
<header>
<a data-tooltip="vote" data-role="discussion-vote" class="vote-btn discussion-vote discussion-vote-up" href="#">
@@ -19,10 +19,28 @@ xdescribe "DiscussionContentView", ->
<div data-tooltip="pin this thread" data-role="thread-pin" class="admin-pin discussion-pin notpinned">
<i class="icon"></i><span class="pin-label">Pin Thread</span></div>
</div>
'''
@
"""
@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();

View File

@@ -48,6 +48,4 @@ describe 'ResponseCommentShowView', ->
it 'produces the correct HTML', ->
@view.render()
expect(@view.el.innerHTML).toContainHtml """
<div
"""
expect(@view.el.innerHTML).toContain('"discussion-flag-abuse notflagged"')