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
c51c1038
Commit
c51c1038
authored
Feb 24, 2017
by
alisan617
Committed by
GitHub
Feb 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14576 from edx/alisan/discussion-topic-TNL-6205
Discussion topic area section after Add Post
parents
28e043ae
4197ebf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletions
+63
-1
common/static/common/js/discussion/views/new_post_view.js
+3
-1
common/static/common/js/spec/discussion/view/new_post_view_spec.js
+60
-0
No files found.
common/static/common/js/discussion/views/new_post_view.js
View file @
c51c1038
...
...
@@ -186,11 +186,13 @@
};
NewPostView
.
prototype
.
resetForm
=
function
()
{
var
$general
;
this
.
$
(
'.forum-new-post-form'
)[
0
].
reset
();
DiscussionUtil
.
clearFormErrors
(
this
.
$
(
'.post-errors'
));
this
.
$
(
'.wmd-preview p'
).
html
(
''
);
if
(
this
.
isTabMode
())
{
this
.
topicView
.
setTopic
(
this
.
$
(
'button.topic-title'
).
first
());
$general
=
this
.
$
(
'.post-topic option:contains(General)'
);
this
.
topicView
.
setTopic
(
$general
||
this
.
$
(
'button.topic-title'
).
first
());
}
};
...
...
common/static/common/js/spec/discussion/view/new_post_view_spec.js
View file @
c51c1038
...
...
@@ -240,6 +240,66 @@
});
});
});
describe
(
'default topic '
,
function
()
{
beforeEach
(
function
()
{
this
.
course_settings
=
new
DiscussionCourseSettings
({
allow_anonymous_to_peers
:
true
,
allow_anonymous
:
true
,
category_map
:
{
subcategories
:
{
'Week 1'
:
{
subcategories
:
{},
children
:
[
[
'Topic-Level Student-Visible Label'
,
'entry'
]
],
entries
:
{
'Topic-Level Student-Visible Label'
:
{
sort_key
:
null
,
is_cohorted
:
false
,
id
:
'2b3a858d0c884eb4b272dbbe3f2ffddd'
}
}
}
},
children
:
[
[
'First topic'
,
'entry'
],
[
'Week 1'
,
'subcategory'
]
],
entries
:
{
'First topic'
:
{
sort_key
:
'First topic'
,
is_cohorted
:
false
,
id
:
'i4x-waqastest-waqastest-course-waqastest'
}
}
}
});
});
it
(
'should be the first topic if General is not found'
,
function
()
{
var
eventSpy
,
view
;
view
=
new
NewPostView
({
el
:
$
(
'#fixture-element'
),
collection
:
this
.
discussion
,
course_settings
:
this
.
course_settings
,
mode
:
'tab'
});
view
.
render
();
eventSpy
=
jasmine
.
createSpy
(
'eventSpy'
);
view
.
listenTo
(
view
,
'newPost:cancel'
,
eventSpy
);
view
.
$
(
'.post-errors'
).
html
(
"<li class='post-error'>Title can't be empty</li>"
);
view
.
$
(
"label[for$='post-type-question']"
).
click
();
view
.
$
(
'.js-post-title'
).
val
(
'Test Title'
);
view
.
$
(
'.js-post-body textarea'
).
val
(
'Test body'
);
view
.
$
(
'.wmd-preview p'
).
html
(
'Test body'
);
view
.
$
(
'input[name=follow]'
).
prop
(
'checked'
,
false
);
view
.
$
(
'input[name=anonymous]'
).
prop
(
'checked'
,
true
);
view
.
$
(
'input[name=anonymous_to_peers]'
).
prop
(
'checked'
,
true
);
view
.
$
(
"a[data-discussion-id='2b3a858d0c884eb4b272dbbe3f2ffddd']"
).
click
();
view
.
$
(
'.cancel'
).
click
();
expect
(
view
.
$
(
'.post-topic option:selected'
).
text
()).
toEqual
(
'First topic'
);
});
});
it
(
'posts to the correct URL'
,
function
()
{
var
topicId
,
view
;
topicId
=
'test_topic'
;
...
...
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