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
11828e90
Commit
11828e90
authored
Sep 06, 2016
by
Brian Jacobel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests - you shouldn't be able to update the topic of an inline post
parent
d103f018
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
+15
-6
No files found.
common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
View file @
11828e90
...
...
@@ -30,11 +30,16 @@
};
});
testUpdate
=
function
(
view
,
thread
,
newTopicId
,
newTopicName
)
{
testUpdate
=
function
(
view
,
thread
,
newTopicId
,
newTopicName
,
mode
)
{
var
discussionMode
=
mode
||
'tab'
;
spyOn
(
$
,
'ajax'
).
and
.
callFake
(
function
(
params
)
{
expect
(
params
.
url
.
path
()).
toEqual
(
DiscussionUtil
.
urlFor
(
'update_thread'
,
'dummy_id'
));
expect
(
params
.
data
.
thread_type
).
toBe
(
'discussion'
);
expect
(
params
.
data
.
commentable_id
).
toBe
(
newTopicId
);
if
(
discussionMode
!==
'inline'
)
{
expect
(
params
.
data
.
commentable_id
).
toBe
(
newTopicId
);
}
expect
(
params
.
data
.
title
).
toBe
(
'changed thread title'
);
params
.
success
();
return
{
...
...
@@ -47,14 +52,18 @@
return
$
(
el
).
data
(
'discussionId'
)
===
newTopicId
;
}).
click
();
// set new topic
view
.
$
(
'.edit-post-title'
).
val
(
'changed thread title'
);
// set new title
view
.
$
(
"label[for$='post-type-discussion']"
).
click
();
// set new thread type
if
(
discussionMode
!==
'inline'
)
{
view
.
$
(
"label[for$='post-type-discussion']"
).
click
();
// set new thread type
}
view
.
$
(
'.post-update'
).
click
();
expect
(
$
.
ajax
).
toHaveBeenCalled
();
expect
(
thread
.
get
(
'title'
)).
toBe
(
'changed thread title'
);
expect
(
thread
.
get
(
'thread_type'
)).
toBe
(
'discussion'
);
expect
(
thread
.
get
(
'commentable_id'
)).
toBe
(
newTopicId
);
expect
(
thread
.
get
(
'courseware_title'
)).
toBe
(
newTopicName
);
if
(
discussionMode
!==
'inline'
)
{
expect
(
thread
.
get
(
'commentable_id'
)).
toBe
(
newTopicId
);
expect
(
thread
.
get
(
'courseware_title'
)).
toBe
(
newTopicName
);
}
expect
(
view
.
$
(
'.edit-post-title'
)).
toHaveValue
(
''
);
expect
(
view
.
$
(
'.wmd-preview p'
)).
toHaveText
(
''
);
};
...
...
@@ -66,7 +75,7 @@
it
(
'can save new data correctly in inline mode'
,
function
()
{
this
.
createEditView
({
'mode'
:
'inline'
});
testUpdate
(
this
.
view
,
this
.
thread
,
'other_topic'
,
'Other Topic'
);
testUpdate
(
this
.
view
,
this
.
thread
,
'other_topic'
,
'Other Topic'
,
'inline'
);
});
testCancel
=
function
(
view
)
{
...
...
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