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
0aba5874
Commit
0aba5874
authored
May 29, 2015
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fieldset and legend solution is lost when edit Problem"
This reverts commit
16a248b9
.
parent
509f27f0
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
50 additions
and
108 deletions
+50
-108
common/lib/capa/capa/capa_problem.py
+1
-22
common/lib/capa/capa/inputtypes.py
+0
-2
common/lib/capa/capa/templates/choicegroup.html
+2
-2
common/lib/capa/capa/tests/test_html_render.py
+0
-1
common/lib/capa/capa/tests/test_input_templates.py
+17
-19
common/lib/capa/capa/tests/test_inputtypes.py
+1
-30
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
+11
-12
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
+1
-3
common/lib/xmodule/xmodule/templates/problem/checkboxes_response.yaml
+12
-11
common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml
+2
-1
common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml
+2
-3
common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml
+0
-1
common/lib/xmodule/xmodule/templates/problem/string_response.yaml
+1
-1
No files found.
common/lib/capa/capa/capa_problem.py
View file @
0aba5874
...
...
@@ -139,7 +139,6 @@ class LoncapaProblem(object):
self
.
do_reset
()
self
.
problem_id
=
id
self
.
capa_system
=
capa_system
self
.
question_label
=
""
state
=
state
or
{}
...
...
@@ -733,7 +732,6 @@ class LoncapaProblem(object):
'status'
:
status
,
'id'
:
input_id
,
'input_state'
:
self
.
input_state
[
input_id
],
'question_label'
:
self
.
question_label
if
self
.
question_label
else
None
,
'answervariable'
:
answervariable
,
'feedback'
:
{
'message'
:
msg
,
...
...
@@ -764,12 +762,8 @@ class LoncapaProblem(object):
tree
=
etree
.
Element
(
problemtree
.
tag
)
for
item
in
problemtree
:
item_xhtml
=
self
.
_extract_html
(
item
)
item_sibling
=
self
.
sibling_for_item
(
problemtree
,
item
)
if
item_xhtml
is
not
None
:
if
item_xhtml
.
tag
==
"legend"
and
item_sibling
is
not
None
and
item_sibling
in
self
.
responders
:
self
.
question_label
=
item_xhtml
.
text
else
:
tree
.
append
(
item_xhtml
)
tree
.
append
(
item_xhtml
)
if
tree
.
tag
in
html_transforms
:
tree
.
tag
=
html_transforms
[
problemtree
.
tag
][
'tag'
]
...
...
@@ -840,18 +834,3 @@ class LoncapaProblem(object):
for
solution
in
tree
.
findall
(
'.//solution'
):
solution
.
attrib
[
'id'
]
=
"
%
s_solution_
%
i"
%
(
self
.
problem_id
,
solution_id
)
solution_id
+=
1
def
sibling_for_item
(
self
,
tree
,
node
):
"""
Check if node exist in problem tree and return next sibling if exist
else return None
"""
problem_tree
=
tree
.
xpath
(
'//problem/*'
)
if
node
in
problem_tree
:
node_index
=
problem_tree
.
index
(
node
)
try
:
return
problem_tree
[
node_index
+
1
]
except
IndexError
:
return
None
else
:
return
None
common/lib/capa/capa/inputtypes.py
View file @
0aba5874
...
...
@@ -214,7 +214,6 @@ class InputTypeBase(object):
self
.
hintmode
=
feedback
.
get
(
'hintmode'
,
None
)
self
.
input_state
=
state
.
get
(
'input_state'
,
{})
self
.
answervariable
=
state
.
get
(
"answervariable"
,
None
)
self
.
question_label
=
state
.
get
(
"question_label"
,
None
)
# put hint above msg if it should be displayed
if
self
.
hintmode
==
'always'
:
...
...
@@ -314,7 +313,6 @@ class InputTypeBase(object):
context
.
update
(
self
.
_extra_context
())
if
self
.
answervariable
:
context
.
update
({
'answervariable'
:
self
.
answervariable
})
context
.
update
({
'question_label'
:
self
.
question_label
if
self
.
question_label
is
not
None
else
""
})
return
context
def
_extra_context
(
self
):
...
...
common/lib/capa/capa/templates/choicegroup.html
View file @
0aba5874
...
...
@@ -17,8 +17,8 @@
% endif
</div>
<fieldset>
<legend>
${question_label}
</legend>
<fieldset
role=
"${input_type}group"
aria-label=
"${label}"
>
% for choice_id, choice_description in choices:
<label
for=
"input_${id}_${choice_id}"
##
If
the
student
has
selected
this
choice
...
...
...
common/lib/capa/capa/tests/test_html_render.py
View file @
0aba5874
...
...
@@ -175,7 +175,6 @@ class CapaHtmlRenderTest(unittest.TestCase):
'label'
:
''
,
'value'
:
''
,
'preprocessor'
:
None
,
'question_label'
:
''
,
'msg'
:
''
,
'inline'
:
False
,
'hidden'
:
False
,
...
...
common/lib/capa/capa/tests/test_input_templates.py
View file @
0aba5874
...
...
@@ -126,7 +126,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
self
.
context
=
{
'id'
:
'1'
,
'choices'
:
choices
,
'status'
:
Status
(
'correct'
),
'question_label'
:
''
,
'label'
:
'test'
,
'input_type'
:
'checkbox'
,
'name_array_suffix'
:
'1'
,
...
...
@@ -142,7 +141,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
self
.
context
[
'status'
]
=
Status
(
'correct'
)
self
.
context
[
'input_type'
]
=
'checkbox'
self
.
context
[
'value'
]
=
[
'1'
,
'2'
]
self
.
context
[
'question_label'
]
=
[
''
]
# Should mark the entire problem correct
xml
=
self
.
render_to_xml
(
self
.
context
)
...
...
@@ -224,8 +222,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked correct.
"""
conditions
=
[
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
'2'
},
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
[
'2'
]}]
{
'input_type'
:
'radio'
,
'value'
:
'2'
},
{
'input_type'
:
'radio'
,
'value'
:
[
'2'
]}]
self
.
context
[
'status'
]
=
Status
(
'correct'
)
...
...
@@ -272,16 +270,16 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
"""
conditions
=
[
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]}]
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'value'
:
[
'2'
]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[
'2'
]}]
self
.
context
[
'show_correctness'
]
=
'never'
self
.
context
[
'submitted_message'
]
=
'Test message'
...
...
@@ -317,9 +315,9 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
"""
conditions
=
[
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'
question_label'
:
''
,
'
value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'unsubmitted'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'unsubmitted'
),
'value'
:
[]},
# These tests expose bug #365
# When the bug is fixed, uncomment these cases.
...
...
@@ -927,7 +925,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked correct."""
conditions
=
[
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
self
.
VALUE_DICT
}]
{
'input_type'
:
'radio'
,
'value'
:
self
.
VALUE_DICT
}]
self
.
context
[
'status'
]
=
'correct'
...
...
@@ -947,7 +945,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked incorrect."""
conditions
=
[
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
self
.
VALUE_DICT
}]
{
'input_type'
:
'radio'
,
'value'
:
self
.
VALUE_DICT
}]
self
.
context
[
'status'
]
=
'incorrect'
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
0aba5874
...
...
@@ -61,7 +61,6 @@ class OptionInputTest(unittest.TestCase):
'value'
:
'Down'
,
'options'
:
[(
'Up'
,
'Up'
),
(
'Down'
,
'Down'
),
(
'Don
\'
t know'
,
'Don
\'
t know'
)],
'status'
:
inputtypes
.
Status
(
'answered'
),
'question_label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'inline'
:
False
,
...
...
@@ -122,7 +121,6 @@ class ChoiceGroupTest(unittest.TestCase):
'id'
:
'sky_input'
,
'value'
:
'foil3'
,
'status'
:
inputtypes
.
Status
(
'answered'
),
'question_label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'input_type'
:
expected_input_type
,
...
...
@@ -176,7 +174,6 @@ class JavascriptInputTest(unittest.TestCase):
'STATIC_URL'
:
'/dummy-static/'
,
'id'
:
'prob_1_2'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
''
,
'value'
:
'3'
,
...
...
@@ -210,7 +207,6 @@ class TextLineTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
'testing 123'
,
'size'
:
size
,
'msg'
:
''
,
...
...
@@ -243,7 +239,6 @@ class TextLineTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'size'
:
size
,
'msg'
:
''
,
...
...
@@ -288,7 +283,6 @@ class TextLineTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'size'
:
size
,
'msg'
:
''
,
...
...
@@ -330,7 +324,6 @@ class FileSubmissionTest(unittest.TestCase):
'STATIC_URL'
:
'/dummy-static/'
,
'id'
:
'prob_1_2'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
'label'
:
''
,
'msg'
:
the_input
.
submitted_msg
,
'value'
:
'BumbleBee.py'
,
...
...
@@ -381,7 +374,6 @@ class CodeInputTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
the_input
.
submitted_msg
,
'mode'
:
mode
,
...
...
@@ -437,7 +429,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
self
.
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
...
...
@@ -469,7 +460,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
...
...
@@ -501,7 +491,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
status
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
''
,
'mode'
:
self
.
mode
,
...
...
@@ -533,7 +522,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
...
...
@@ -660,14 +648,7 @@ class MatlabTest(unittest.TestCase):
output
=
self
.
the_input
.
get_html
()
self
.
assertEqual
(
etree
.
tostring
(
output
),
" "
.
join
(
textwrap
.
dedent
(
"""
<div>{
\'
status
\'
: Status(
\'
queued
\'
),
\'
button_enabled
\'
: True,
\'
rows
\'
:
\'
10
\'
,
\'
queue_len
\'
:
\'
3
\'
,
\'
question_label
\'
:
\'\'
,
\'
mode
\'
:
\'\'
,
\'
cols
\'
:
\'
80
\'
,
\'
STATIC_URL
\'
:
\'
/dummy-static/
\'
,
\'
linenumbers
\'
:
\'
true
\'
,
\'
queue_msg
\'
:
\'\'
,
\'
value
\'
:
\'
print "good evening"
\'
,
\'
msg
\'
: u
\'
Submitted. As soon as a response is returned, this message will be replaced by that feedback.
\'
,
\'
matlab_editor_js
\'
:
\'
/dummy-static/js/vendor/CodeMirror/octave.js
\'
,
\'
hidden
\'
:
\'\'
,
\'
id
\'
:
\'
prob_1_2
\'
,
\'
tabsize
\'
: 4}</div>
"""
)
.
replace
(
'
\n
'
,
' '
)
.
split
())
"""<div>{
\'
status
\'
: Status(
\'
queued
\'
),
\'
button_enabled
\'
: True,
\'
rows
\'
:
\'
10
\'
,
\'
queue_len
\'
:
\'
3
\'
,
\'
mode
\'
:
\'\'
,
\'
cols
\'
:
\'
80
\'
,
\'
STATIC_URL
\'
:
\'
/dummy-static/
\'
,
\'
linenumbers
\'
:
\'
true
\'
,
\'
queue_msg
\'
:
\'\'
,
\'
value
\'
:
\'
print "good evening"
\'
,
\'
msg
\'
: u
\'
Submitted. As soon as a response is returned, this message will be replaced by that feedback.
\'
,
\'
matlab_editor_js
\'
:
\'
/dummy-static/js/vendor/CodeMirror/octave.js
\'
,
\'
hidden
\'
:
\'\'
,
\'
id
\'
:
\'
prob_1_2
\'
,
\'
tabsize
\'
: 4}</div>"""
)
# test html, that is correct HTML5 html, but is not parsable by XML parser.
...
...
@@ -758,7 +739,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
'msg'
:
self
.
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
'rows'
:
self
.
rows
,
...
...
@@ -868,7 +848,6 @@ class SchematicTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'initial_value'
:
initial_value
,
...
...
@@ -913,7 +892,6 @@ class ImageInputTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
'label'
:
''
,
'width'
:
width
,
'height'
:
height
,
...
...
@@ -969,7 +947,6 @@ class CrystallographyTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
''
,
'width'
:
width
,
...
...
@@ -1012,7 +989,6 @@ class VseprTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
'msg'
:
''
,
'width'
:
width
,
'height'
:
height
,
...
...
@@ -1046,7 +1022,6 @@ class ChemicalEquationTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'H2OYeah'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'size'
:
self
.
size
,
...
...
@@ -1136,7 +1111,6 @@ class FormulaEquationTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
'x^2+1/2'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'size'
:
self
.
size
,
...
...
@@ -1266,7 +1240,6 @@ class DragAndDropTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
''
,
'drag_and_drop_json'
:
json
.
dumps
(
user_input
)
...
...
@@ -1319,7 +1292,6 @@ class AnnotationInputTest(unittest.TestCase):
'STATIC_URL'
:
'/dummy-static/'
,
'id'
:
'annotation_input'
,
'status'
:
inputtypes
.
Status
(
'answered'
),
'question_label'
:
''
,
# 'label': '',
'msg'
:
''
,
'title'
:
'foo'
,
...
...
@@ -1396,7 +1368,6 @@ class TestChoiceText(unittest.TestCase):
expected
=
{
'STATIC_URL'
:
'/dummy-static/'
,
'msg'
:
''
,
'question_label'
:
''
,
'label'
:
''
,
'input_type'
:
expected_input_type
,
'choices'
:
choices
,
...
...
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
View file @
0aba5874
...
...
@@ -509,7 +509,7 @@ describe 'MarkdownEditingDescriptor', ->
[Explanation]
"""
)
expect
(
data
).
toEqual
(
"""<problem>
<
legend>Who lead the civil right movement in the United States of America?</legend
>
<
p>Who lead the civil right movement in the United States of America?</p
>
<stringresponse answer="w*.?s*Luther Kings*.*" type="ci regexp" >
<textline label="Who lead the civil right movement in the United States of America?" size="20"/>
</stringresponse>
...
...
@@ -541,14 +541,14 @@ describe 'MarkdownEditingDescriptor', ->
expect
(
data
).
toEqual
(
"""<problem>
<p>France is a country in Europe.</p>
<
legend>What is the capital of France?</legend
>
<
p>What is the capital of France?</p
>
<stringresponse answer="Paris" type="ci" >
<textline label="What is the capital of France?" size="20"/>
</stringresponse>
<p>Germany is a country in Europe, too.</p>
<
legend>What is the capital of Germany?</legend
>
<
p>What is the capital of Germany?</p
>
<multiplechoiceresponse>
<choicegroup label="What is the capital of Germany?" type="MultipleChoice">
<choice correct="false">Bonn</choice>
...
...
@@ -574,12 +574,11 @@ describe 'MarkdownEditingDescriptor', ->
( ) Hamburg
(x) Berlin
( ) Donut
"""
)
expect
(
data
).
toEqual
(
"""<problem>
<p>France is a country in Europe.</p>
<
legend>What is the capital of France?</legend
>
<
p>What is the capital of France?</p
>
<stringresponse answer="Paris" type="ci" >
<textline label="What is the capital of France?" size="20"/>
</stringresponse>
...
...
@@ -595,8 +594,8 @@ describe 'MarkdownEditingDescriptor', ->
<choice correct="false">Donut</choice>
</choicegroup>
</multiplechoiceresponse>
</problem>"""
)
it
'tests malformed labels'
,
->
data
=
MarkdownEditingDescriptor
.
markdownToXml
(
"""
...
...
@@ -605,7 +604,7 @@ describe 'MarkdownEditingDescriptor', ->
>>What is the capital of France?<
= Paris
>>What is the capital of <<Germany?<<
blah
>>What is the capital of <<Germany?<<
( ) Bonn
( ) Hamburg
(x) Berlin
...
...
@@ -619,7 +618,7 @@ describe 'MarkdownEditingDescriptor', ->
<textline size="20"/>
</stringresponse>
<
legend>What is the capital of Germany?</legend
>
<
p>blahWhat is the capital of Germany?</p
>
<multiplechoiceresponse>
<choicegroup label="What is the capital of <<Germany?" type="MultipleChoice">
<choice correct="false">Bonn</choice>
...
...
@@ -637,7 +636,7 @@ describe 'MarkdownEditingDescriptor', ->
= 3.14159 +- .02
"""
)
expect
(
data
).
toEqual
(
"""<problem>
<
legend>Enter the numerical value of Pi:</legend
>
<
p>Enter the numerical value of Pi:</p
>
<numericalresponse answer="3.14159">
<responseparam type="tolerance" default=".02" />
<formulaequationinput label="Enter the numerical value of Pi:" />
...
...
@@ -651,7 +650,7 @@ describe 'MarkdownEditingDescriptor', ->
= Paris
"""
)
expect
(
data
).
toEqual
(
"""<problem>
<
legend>What is the "capital" of France & the 'best' > place < to live"?</legend
>
<
p>What is the "capital" of France & the 'best' > place < to live"?</p
>
<stringresponse answer="Paris" type="ci" >
<textline label="What is the "capital" of France & the 'best' > place < to live"?" size="20"/>
</stringresponse>
...
...
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
View file @
0aba5874
...
...
@@ -371,9 +371,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
.
replace
(
/>/g
,
'>'
)
.
replace
(
/"/g
,
'"'
)
.
replace
(
/'/g
,
'''
);
line
=
line
.
replace
(
/>>/g
,
'<legend>'
);
line
=
line
.
replace
(
/<+$/g
,
'</legend>'
);
line
=
line
.
replace
(
/<</g
,
''
);
line
=
line
.
replace
(
/>>|<</g
,
''
);
}
else
if
(
line
.
match
(
/<\w+response/
)
&&
didinput
&&
curlabel
==
prevlabel
)
{
//
reset
label
to
prevent
gobbling
up
previous
one
(
if
multiple
questions
)
curlabel
=
''
;
...
...
common/lib/xmodule/xmodule/templates/problem/checkboxes_response.yaml
View file @
0aba5874
...
...
@@ -16,7 +16,6 @@ metadata:
[x] French
[ ] Hungarian
Note: Make sure you select all of the correct options—there may be more than one!
[explanation]
...
...
@@ -29,16 +28,18 @@ data: |
<p>When you add the component, be sure to select <strong>Settings</strong>
to specify a <strong>Display Name</strong> and other values that apply.</p>
<p>You can use the following example problem as a model.</p>
<legend>The following languages are in the Indo-European family:</legend>
<choiceresponse>
<checkboxgroup direction="vertical">
<choice correct="true" name="urdu">Urdu</choice>
<choice correct="false" name="finnish">Finnish</choice>
<choice correct="true" name="marathi">Marathi</choice>
<choice correct="true" name="french">French</choice>
<choice correct="false" name="hungarian">Hungarian</choice>
</checkboxgroup>
</choiceresponse>
<fieldset>
<legend>The following languages are in the Indo-European family:</legend>
<choiceresponse>
<checkboxgroup direction="vertical">
<choice correct="true" name="urdu">Urdu</choice>
<choice correct="false" name="finnish">Finnish</choice>
<choice correct="true" name="marathi">Marathi</choice>
<choice correct="true" name="french">French</choice>
<choice correct="false" name="hungarian">Hungarian</choice>
</checkboxgroup>
</choiceresponse>
</fieldset>
<p><strong>Note</strong>: Make sure you select all of the correct options—there may be more than one!</p>
<solution>
<div class="detailed-solution">
...
...
common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml
View file @
0aba5874
...
...
@@ -15,7 +15,6 @@ metadata:
(x) Indonesia
( ) Russia
[explanation]
According to September 2014 estimates:
The population of Indonesia is approximately 250 million.
...
...
@@ -31,6 +30,7 @@ data: |
<p>When you add the problem, be sure to select <strong>Settings</strong>
to specify a <strong>Display Name</strong> and other values that apply.</p>
<p>You can use the following example problem as a model.</p>
<fieldset>
<legend>Which of the following countries has the largest population?</legend>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice">
...
...
@@ -40,6 +40,7 @@ data: |
<choice correct="false" name="russia">Russia</choice>
</choicegroup>
</multiplechoiceresponse>
</fieldset>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
...
...
common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml
View file @
0aba5874
...
...
@@ -14,12 +14,11 @@ metadata:
>>How many miles away from Earth is the sun? Use scientific notation to answer.<<
= 9.3*10^6
or= 9.296*10^6
or= 9.296*10^6
>>The square of what number is -100?<<
= 10*i
= 10*i
[explanation]
The sun is 93,000,000, or 9.3*10^6, miles away from Earth.
...
...
common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml
View file @
0aba5874
...
...
@@ -14,7 +14,6 @@ metadata:
[[(India), Spain, China, Bermuda]]
[explanation]
India became an independent nation on August 15, 1947.
[explanation]
...
...
common/lib/xmodule/xmodule/templates/problem/string_response.yaml
View file @
0aba5874
...
...
@@ -14,7 +14,7 @@ metadata:
= Nanjing Higher Normal Institute
or= National Central University
or= Nanjing University
[explanation]
Nanjing Higher Normal Institute first admitted female students in 1920.
[explanation]
...
...
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