Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
958060a0
Commit
958060a0
authored
Apr 03, 2014
by
Joe Blaylock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TIM-435: Prevent whitespace-only submissions
parent
86c20003
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
apps/openassessment/xblock/static/js/openassessment.min.js
+0
-0
apps/openassessment/xblock/static/js/spec/oa_response.js
+7
-0
apps/openassessment/xblock/static/js/src/oa_response.js
+2
-2
No files found.
apps/openassessment/xblock/static/js/openassessment.min.js
View file @
958060a0
This diff is collapsed.
Click to expand it.
apps/openassessment/xblock/static/js/spec/oa_response.js
View file @
958060a0
...
...
@@ -65,6 +65,13 @@ describe("OpenAssessment.ResponseView", function() {
expect
(
view
.
saveEnabled
()).
toBe
(
false
);
expect
(
view
.
saveStatus
()).
toContain
(
'Unsaved draft'
);
// Response is whitespace --> save/submit buttons disabled
view
.
response
(
'
\
n
\
n '
);
view
.
responseChanged
();
expect
(
view
.
submitEnabled
()).
toBe
(
false
);
expect
(
view
.
saveEnabled
()).
toBe
(
false
);
expect
(
view
.
saveStatus
()).
toContain
(
'Unsaved draft'
);
// Response is not blank --> submit button enabled
view
.
response
(
'Test response'
);
view
.
responseChanged
();
...
...
apps/openassessment/xblock/static/js/src/oa_response.js
View file @
958060a0
...
...
@@ -170,12 +170,12 @@ OpenAssessment.ResponseView.prototype = {
**/
responseChanged
:
function
()
{
// Enable the save/submit button only for non-blank responses
var
currentResponse
=
this
.
response
(
);
var
currentResponse
=
$
.
trim
(
this
.
response
()
);
var
isBlank
=
(
currentResponse
!==
''
);
this
.
submitEnabled
(
isBlank
);
// Update the save button and status only if the response has changed
if
(
this
.
savedResponse
!==
currentResponse
)
{
if
(
$
.
trim
(
this
.
savedResponse
)
!==
currentResponse
)
{
this
.
saveEnabled
(
isBlank
);
this
.
saveStatus
(
'Unsaved draft'
);
}
...
...
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