Commit 296a8781 by Your Name

add flagging tests to DiscussionContentView

parent ce2308b5
...@@ -2,24 +2,26 @@ describe "DiscussionContentView", -> ...@@ -2,24 +2,26 @@ describe "DiscussionContentView", ->
beforeEach -> beforeEach ->
setFixtures setFixtures
""" (
<div class="discussion-post"> """
<header> <div class="discussion-post">
<a data-tooltip="vote" data-role="discussion-vote" class="vote-btn discussion-vote discussion-vote-up" href="#"> <header>
<span class="plus-icon">+</span> <span class="votes-count-number">0</span></a> <a data-tooltip="vote" data-role="discussion-vote" class="vote-btn discussion-vote discussion-vote-up" href="#">
<h1>Post Title</h1> <span class="plus-icon">+</span> <span class="votes-count-number">0</span></a>
<p class="posted-details"> <h1>Post Title</h1>
<a class="username" href="/courses/MITx/999/Robot_Super_Course/discussion/forum/users/1">robot</a> <p class="posted-details">
<span title="2013-05-08T17:34:07Z" class="timeago">less than a minute ago</span> <a class="username" href="/courses/MITx/999/Robot_Super_Course/discussion/forum/users/1">robot</a>
</p> <span title="2013-05-08T17:34:07Z" class="timeago">less than a minute ago</span>
</header> </p>
<div class="post-body"><p>Post body.</p></div> </header>
<div data-tooltip="Report Misuse" data-role="thread-flag" class="discussion-flag-abuse notflagged"> <div class="post-body"><p>Post body.</p></div>
<i class="icon"></i><span class="flag-label">Report Misuse</span></div> <div data-tooltip="Report Misuse" data-role="thread-flag" class="discussion-flag-abuse notflagged">
<div data-tooltip="pin this thread" data-role="thread-pin" class="admin-pin discussion-pin notpinned"> <i class="icon"></i><span class="flag-label">Report Misuse</span></div>
<i class="icon"></i><span class="pin-label">Pin Thread</span></div> <div data-tooltip="pin this thread" data-role="thread-pin" class="admin-pin discussion-pin notpinned">
</div> <i class="icon"></i><span class="pin-label">Pin Thread</span></div>
""" </div>
""")
@thread = new Thread { @thread = new Thread {
id: '01234567', id: '01234567',
user_id: '567', user_id: '567',
...@@ -47,10 +49,9 @@ describe "DiscussionContentView", -> ...@@ -47,10 +49,9 @@ describe "DiscussionContentView", ->
@thread.flagAbuse() @thread.flagAbuse()
expect(@thread.get 'abuse_flaggers').toEqual ['123', '567'] expect(@thread.get 'abuse_flaggers').toEqual ['123', '567']
it 'can be unflagged for abuse', -> it 'can be unflagged for abuse', ->
temp_array = [] temp_array = []
temp_array.push(window.user.get('id')) temp_array.push(window.user.get('id'))
@thread.set("abuse_flaggers",temp_array) @thread.set("abuse_flaggers",temp_array)
@thread.unflagAbuse() @thread.unflagAbuse()
expect(@thread.get 'abuse_flaggers').toEqual [] expect(@thread.get 'abuse_flaggers').toEqual []
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment