Commit cfc5857d by jsa Committed by Zia Fazal

allow TAs to select the cohort of new posts.

TNL-153
parent e4d464fc
...@@ -109,6 +109,7 @@ browser and pasting the output. When that file changes, this one should be rege ...@@ -109,6 +109,7 @@ browser and pasting the output. When that file changes, this one should be rege
</div> </div>
<input type="submit" id="edit-post-submit" class="post-update" value="Update post"> <input type="submit" id="edit-post-submit" class="post-update" value="Update post">
<a href="#" class="post-cancel">Cancel</a> <a href="#" class="post-cancel">Cancel</a>
</div>
</script> </script>
<script aria-hidden="true" type="text/template" id="thread-response-template"> <script aria-hidden="true" type="text/template" id="thread-response-template">
......
...@@ -226,19 +226,26 @@ describe "NewPostView", -> ...@@ -226,19 +226,26 @@ describe "NewPostView", ->
mode: "tab" mode: "tab"
) )
expectCohortSelectorVisible = (view, visible) -> checkVisibility = (view, expectedVisible) =>
expect(view.$(".js-group-select").is(":visible")).toEqual(visible) view.render()
expect(view.$(".js-group-select").is(":visible")).toEqual(expectedVisible)
if expectedVisible
expect(view.$(".js-group-select").prop("disabled")).toEqual(false)
it "is not visible to students", -> it "is not visible to students", ->
@view.render() checkVisibility(@view, false)
expectCohortSelectorVisible(@view, false)
it "allows TAs to see the cohort selector", ->
DiscussionSpecHelper.makeTA()
checkVisibility(@view, true)
it "allows moderators to select visibility", -> it "allows moderators to see the cohort selector", ->
DiscussionSpecHelper.makeModerator() DiscussionSpecHelper.makeModerator()
@view.render() checkVisibility(@view, true)
expectCohortSelectorVisible(@view, true)
expect(@view.$(".js-group-select").prop("disabled")).toEqual(false)
it "allows the user to make a cohort selection", ->
DiscussionSpecHelper.makeModerator()
@view.render()
expectedGroupId = null expectedGroupId = null
DiscussionSpecHelper.makeAjaxSpy( DiscussionSpecHelper.makeAjaxSpy(
(params) -> expect(params.data.group_id).toEqual(expectedGroupId) (params) -> expect(params.data.group_id).toEqual(expectedGroupId)
......
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