Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6e4ccfb7
Commit
6e4ccfb7
authored
Dec 22, 2014
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Jasmine tests for always_cohort_inline_discussions.
parent
68fcdcc0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
7 deletions
+50
-7
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
+1
-1
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
+49
-6
No files found.
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
View file @
6e4ccfb7
...
...
@@ -321,7 +321,7 @@ browser and pasting the output. When that file changes, this one should be rege
<label class="field-label">
<span class="field-label-text">
Visible To:
</span><select class="field-input js-group-select" name="group_id">
</span><select class="field-input js-group-select" name="group_id"
<% if (!is_commentable_cohorted) { %>disabled<% } %>
>
<option value="">All Groups</option>
<% _.each(cohort_options, function(opt) { %>
<option value="<%= opt.value %>" <% if (opt.selected) { %>selected<% } %>><%- opt.text %></option>
...
...
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
View file @
6e4ccfb7
...
...
@@ -10,6 +10,15 @@ describe "NewPostView", ->
)
@
discussion
=
new
Discussion
([],
{
pages
:
1
})
checkVisibility
=
(
view
,
expectedVisible
,
expectedDisabled
)
=>
view
.
render
()
expect
(
view
.
$
(
".js-group-select"
).
is
(
":visible"
)).
toEqual
(
expectedVisible
)
disabled
=
view
.
$
(
".js-group-select"
).
prop
(
"disabled"
)
if
expectedVisible
and
!
expectedDisabled
expect
(
disabled
).
toEqual
(
false
)
else
if
expectedDisabled
expect
(
disabled
).
toEqual
(
true
)
describe
"cohort selector"
,
->
beforeEach
->
@
course_settings
=
new
DiscussionCourseSettings
({
...
...
@@ -32,12 +41,6 @@ describe "NewPostView", ->
mode
:
"tab"
)
checkVisibility
=
(
view
,
expectedVisible
)
=>
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"
,
->
checkVisibility
(
@
view
,
false
)
...
...
@@ -69,6 +72,46 @@ describe "NewPostView", ->
$
.
ajax
.
reset
()
)
describe
"always cohort inline discussions "
,
->
beforeEach
->
@
course_settings
=
new
DiscussionCourseSettings
({
"category_map"
:
{
"children"
:
[],
"entries"
:
{}
},
"allow_anonymous"
:
false
,
"allow_anonymous_to_peers"
:
false
,
"is_cohorted"
:
true
,
"cohorts"
:
[
{
"id"
:
1
,
"name"
:
"Cohort1"
},
{
"id"
:
2
,
"name"
:
"Cohort2"
}
]
})
@
view
=
new
NewPostView
(
el
:
$
(
"#fixture-element"
),
collection
:
@
discussion
,
course_settings
:
@
course_settings
,
mode
:
"tab"
)
it
"disables the cohort menu if it is set false"
,
->
DiscussionSpecHelper
.
makeModerator
()
@
view
.
is_commentable_cohorted
=
false
checkVisibility
(
@
view
,
true
,
true
)
it
"enables the cohort menu if it is set true"
,
->
DiscussionSpecHelper
.
makeModerator
()
@
view
.
is_commentable_cohorted
=
true
checkVisibility
(
@
view
,
true
)
it
"is not visible to students when set false"
,
->
@
view
.
is_commentable_cohorted
=
false
checkVisibility
(
@
view
,
false
)
it
"is not visible to students when set true"
,
->
@
view
.
is_commentable_cohorted
=
true
checkVisibility
(
@
view
,
false
)
describe
"cancel post resets form "
,
->
beforeEach
->
@
course_settings
=
new
DiscussionCourseSettings
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment