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
48bec75b
Commit
48bec75b
authored
8 years ago
by
Asad Azam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Course handouts rejects deletion of all text
parent
28e3b1cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletions
+19
-1
cms/static/coffee/spec/views/course_info_spec.coffee
+14
-0
cms/static/js/views/course_info_handout.js
+5
-1
No files found.
cms/static/coffee/spec/views/course_info_spec.coffee
View file @
48bec75b
...
...
@@ -232,6 +232,20 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
@
handoutsEdit
.
render
()
it
"saves <ol></ol> when content left empty"
,
->
requests
=
AjaxHelpers
[
"requests"
](
this
)
# Enter empty string in the handouts section, verifying that the model
# is saved with '<ol></ol>' instead of the empty string
@
handoutsEdit
.
$el
.
find
(
'.edit-button'
).
click
()
spyOn
(
@
handoutsEdit
.
$codeMirror
,
'getValue'
).
and
.
returnValue
(
''
)
spyOn
(
@
model
,
"save"
).
and
.
callThrough
()
@
handoutsEdit
.
$el
.
find
(
'.save-button'
).
click
()
expect
(
@
model
.
save
).
toHaveBeenCalled
()
contentSaved
=
JSON
.
parse
(
requests
[
requests
.
length
-
1
].
requestBody
).
data
expect
(
contentSaved
).
toEqual
(
'<ol></ol>'
)
it
"does not rewrite links on save"
,
->
requests
=
AjaxHelpers
[
"requests"
](
this
)
...
...
This diff is collapsed.
Click to expand it.
cms/static/js/views/course_info_handout.js
View file @
48bec75b
...
...
@@ -50,10 +50,14 @@ define(['js/views/baseview', 'codemirror', 'common/js/components/views/feedback_
},
onSave
:
function
(
event
)
{
var
handoutsContent
=
this
.
$codeMirror
.
getValue
();
$
(
'#handout_error'
).
removeClass
(
'is-shown'
);
$
(
'.save-button'
).
removeClass
(
'is-disabled'
).
attr
(
'aria-disabled'
,
false
);
if
(
$
(
'.CodeMirror-lines'
).
find
(
'.cm-error'
).
length
==
0
)
{
this
.
model
.
set
(
'data'
,
this
.
$codeMirror
.
getValue
());
if
(
handoutsContent
===
''
)
{
handoutsContent
=
'<ol></ol>'
;
}
this
.
model
.
set
(
'data'
,
handoutsContent
);
var
saving
=
new
NotificationView
.
Mini
({
title
:
gettext
(
'Saving'
)
});
...
...
This diff is collapsed.
Click to expand it.
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