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
e2ce9777
Commit
e2ce9777
authored
Sep 23, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed multiple JsInput's in problem.
TNL-269
parent
e895e101
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
common/lib/xmodule/xmodule/js/fixtures/jsinput_problem.html
+53
-0
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
+11
-0
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+4
-2
No files found.
common/lib/xmodule/xmodule/js/fixtures/jsinput_problem.html
0 → 100644
View file @
e2ce9777
<h2
class=
"problem-header"
>
Custom Javascript Display and Grading
</h2>
<div
role=
"application"
class=
"problem"
>
<div>
<span>
<section
data-processed=
"true"
data-sop=
"false"
data-setstate=
"WebGLDemo.setState"
data-getstate=
"WebGLDemo.getState"
data-stored=
""
data=
"WebGLDemo.getGrade"
class=
"jsinput"
id=
"inputtype_1_"
>
<div
id=
"status_1_"
class=
"correct"
>
<iframe
width=
"400"
height=
"400"
frameborder=
"0"
src=
"https://studio.edx.org/c4x/edX/DemoX/asset/webGLDemo.html"
seamless=
"seamless"
sandbox=
"allow-scripts allow-popups allow-same-origin allow-forms allow-pointer-lock"
id=
"iframe_1_"
name=
"iframe_1_"
>
</iframe>
<input
type=
"hidden"
value=
""
waitfor=
""
id=
"input_1_1"
name=
"input_1_1"
>
</div>
</section>
</span>
<span>
<section
data-processed=
"true"
data-sop=
"false"
data-setstate=
"WebGLDemo.setState"
data-getstate=
"WebGLDemo.getState"
data-stored=
""
data=
"WebGLDemo.getGrade"
class=
"jsinput"
id=
"inputtype_1_"
>
<div
id=
"status_1_"
class=
"incorrect"
>
<iframe
width=
"400"
height=
"400"
frameborder=
"0"
src=
"https://studio.edx.org/c4x/edX/DemoX/asset/webGLDemo.html"
seamless=
"seamless"
sandbox=
"allow-scripts allow-popups allow-same-origin allow-forms allow-pointer-lock"
id=
"iframe_1_"
name=
"iframe_1_"
>
</iframe>
<input
type=
"hidden"
value=
""
id=
"input_1_2"
name=
"input_1_2"
>
</div>
</section>
</span>
</div>
<div
class=
"action"
>
<input
type=
"hidden"
value=
"Custom Javascript Display and Grading"
name=
"problem_id"
>
<input
type=
"button"
value=
"Reset"
class=
"reset"
>
<button
class=
"show"
><span
aria-hidden=
"true"
class=
"show-label"
>
Show Answer
</span>
<span
class=
"sr"
>
Reveal Answer
</span></button>
</div>
</div>
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
View file @
e2ce9777
...
...
@@ -604,3 +604,14 @@ describe 'Problem', ->
xit
'serialize all answers'
,
->
@
problem
.
refreshAnswers
()
expect
(
@
problem
.
answers
).
toEqual
"input_1_1=one&input_1_2=two"
describe
'multiple JsInput in single problem'
,
->
jsinput_html
=
readFixtures
(
'jsinput_problem.html'
)
beforeEach
->
@
problem
=
new
Problem
(
$
(
'.xblock-student_view'
))
@
problem
.
render
(
jsinput_html
)
it
'check_save_waitfor should return false'
,
->
$
(
@
problem
.
inputs
[
0
]).
data
(
'waitfor'
,
->
)
expect
(
@
problem
.
check_save_waitfor
()).
toEqual
(
false
)
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
e2ce9777
...
...
@@ -180,6 +180,7 @@ class @Problem
# and specify the function to be called by the check button before sending
# off @answers
check_save_waitfor
:
(
callback
)
=>
flag
=
false
for
inp
in
@
inputs
if
(
$
(
inp
).
is
(
"input[waitfor]"
))
try
...
...
@@ -193,9 +194,10 @@ class @Problem
else
alert
"Could not grade your answer. The submission was aborted."
throw
e
return
true
flag
=
true
else
return
false
flag
=
false
return
flag
###
...
...
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