Commit cc747011 by Adam

Merge pull request #8283 from edx/hotfix/2015-05-29

Hotfix/2015 05 29
parents 3d878240 0aba5874
...@@ -139,7 +139,6 @@ class LoncapaProblem(object): ...@@ -139,7 +139,6 @@ class LoncapaProblem(object):
self.do_reset() self.do_reset()
self.problem_id = id self.problem_id = id
self.capa_system = capa_system self.capa_system = capa_system
self.question_label = ""
state = state or {} state = state or {}
...@@ -733,7 +732,6 @@ class LoncapaProblem(object): ...@@ -733,7 +732,6 @@ class LoncapaProblem(object):
'status': status, 'status': status,
'id': input_id, 'id': input_id,
'input_state': self.input_state[input_id], 'input_state': self.input_state[input_id],
'question_label': self.question_label if self.question_label else None,
'answervariable': answervariable, 'answervariable': answervariable,
'feedback': { 'feedback': {
'message': msg, 'message': msg,
...@@ -764,12 +762,8 @@ class LoncapaProblem(object): ...@@ -764,12 +762,8 @@ class LoncapaProblem(object):
tree = etree.Element(problemtree.tag) tree = etree.Element(problemtree.tag)
for item in problemtree: for item in problemtree:
item_xhtml = self._extract_html(item) item_xhtml = self._extract_html(item)
item_sibling = self.sibling_for_item(problemtree, item)
if item_xhtml is not None: if item_xhtml is not None:
if item_xhtml.tag == "legend" and item_sibling is not None and item_sibling in self.responders: tree.append(item_xhtml)
self.question_label = item_xhtml.text
else:
tree.append(item_xhtml)
if tree.tag in html_transforms: if tree.tag in html_transforms:
tree.tag = html_transforms[problemtree.tag]['tag'] tree.tag = html_transforms[problemtree.tag]['tag']
...@@ -840,18 +834,3 @@ class LoncapaProblem(object): ...@@ -840,18 +834,3 @@ class LoncapaProblem(object):
for solution in tree.findall('.//solution'): for solution in tree.findall('.//solution'):
solution.attrib['id'] = "%s_solution_%i" % (self.problem_id, solution_id) solution.attrib['id'] = "%s_solution_%i" % (self.problem_id, solution_id)
solution_id += 1 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
...@@ -214,7 +214,6 @@ class InputTypeBase(object): ...@@ -214,7 +214,6 @@ class InputTypeBase(object):
self.hintmode = feedback.get('hintmode', None) self.hintmode = feedback.get('hintmode', None)
self.input_state = state.get('input_state', {}) self.input_state = state.get('input_state', {})
self.answervariable = state.get("answervariable", None) self.answervariable = state.get("answervariable", None)
self.question_label = state.get("question_label", None)
# put hint above msg if it should be displayed # put hint above msg if it should be displayed
if self.hintmode == 'always': if self.hintmode == 'always':
...@@ -314,7 +313,6 @@ class InputTypeBase(object): ...@@ -314,7 +313,6 @@ class InputTypeBase(object):
context.update(self._extra_context()) context.update(self._extra_context())
if self.answervariable: if self.answervariable:
context.update({'answervariable': self.answervariable}) context.update({'answervariable': self.answervariable})
context.update({'question_label': self.question_label if self.question_label is not None else ""})
return context return context
def _extra_context(self): def _extra_context(self):
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
% endif % endif
</div> </div>
<fieldset> <fieldset role="${input_type}group" aria-label="${label}">
<legend>${question_label}</legend>
% for choice_id, choice_description in choices: % for choice_id, choice_description in choices:
<label for="input_${id}_${choice_id}" <label for="input_${id}_${choice_id}"
## If the student has selected this choice... ## If the student has selected this choice...
......
...@@ -175,7 +175,6 @@ class CapaHtmlRenderTest(unittest.TestCase): ...@@ -175,7 +175,6 @@ class CapaHtmlRenderTest(unittest.TestCase):
'label': '', 'label': '',
'value': '', 'value': '',
'preprocessor': None, 'preprocessor': None,
'question_label': '',
'msg': '', 'msg': '',
'inline': False, 'inline': False,
'hidden': False, 'hidden': False,
......
...@@ -126,7 +126,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase): ...@@ -126,7 +126,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
self.context = {'id': '1', self.context = {'id': '1',
'choices': choices, 'choices': choices,
'status': Status('correct'), 'status': Status('correct'),
'question_label': 'test',
'label': 'test', 'label': 'test',
'input_type': 'checkbox', 'input_type': 'checkbox',
'name_array_suffix': '1', 'name_array_suffix': '1',
...@@ -142,7 +141,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase): ...@@ -142,7 +141,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
self.context['status'] = Status('correct') self.context['status'] = Status('correct')
self.context['input_type'] = 'checkbox' self.context['input_type'] = 'checkbox'
self.context['value'] = ['1', '2'] self.context['value'] = ['1', '2']
self.context['question_label'] = ['']
# Should mark the entire problem correct # Should mark the entire problem correct
xml = self.render_to_xml(self.context) xml = self.render_to_xml(self.context)
...@@ -224,8 +222,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase): ...@@ -224,8 +222,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked correct. (not the entire problem) is marked correct.
""" """
conditions = [ conditions = [
{'input_type': 'radio', 'question_label': '', 'value': '2'}, {'input_type': 'radio', 'value': '2'},
{'input_type': 'radio', 'question_label': '', 'value': ['2']}] {'input_type': 'radio', 'value': ['2']}]
self.context['status'] = Status('correct') self.context['status'] = Status('correct')
...@@ -272,16 +270,16 @@ class ChoiceGroupTemplateTest(TemplateTestCase): ...@@ -272,16 +270,16 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
""" """
conditions = [ conditions = [
{'input_type': 'radio', 'status': Status('correct'), 'question_label': '', 'value': ''}, {'input_type': 'radio', 'status': Status('correct'), 'value': ''},
{'input_type': 'radio', 'status': Status('correct'), 'question_label': '', 'value': '2'}, {'input_type': 'radio', 'status': Status('correct'), 'value': '2'},
{'input_type': 'radio', 'status': Status('correct'), 'question_label': '', 'value': ['2']}, {'input_type': 'radio', 'status': Status('correct'), 'value': ['2']},
{'input_type': 'radio', 'status': Status('incorrect'), 'question_label': '', 'value': '2'}, {'input_type': 'radio', 'status': Status('incorrect'), 'value': '2'},
{'input_type': 'radio', 'status': Status('incorrect'), 'question_label': '', 'value': []}, {'input_type': 'radio', 'status': Status('incorrect'), 'value': []},
{'input_type': 'radio', 'status': Status('incorrect'), 'question_label': '', 'value': ['2']}, {'input_type': 'radio', 'status': Status('incorrect'), 'value': ['2']},
{'input_type': 'checkbox', 'status': Status('correct'), 'question_label': '', 'value': []}, {'input_type': 'checkbox', 'status': Status('correct'), 'value': []},
{'input_type': 'checkbox', 'status': Status('correct'), 'question_label': '', 'value': ['2']}, {'input_type': 'checkbox', 'status': Status('correct'), 'value': ['2']},
{'input_type': 'checkbox', 'status': Status('incorrect'), 'question_label': '', 'value': []}, {'input_type': 'checkbox', 'status': Status('incorrect'), 'value': []},
{'input_type': 'checkbox', 'status': Status('incorrect'), 'question_label': '', 'value': ['2']}] {'input_type': 'checkbox', 'status': Status('incorrect'), 'value': ['2']}]
self.context['show_correctness'] = 'never' self.context['show_correctness'] = 'never'
self.context['submitted_message'] = 'Test message' self.context['submitted_message'] = 'Test message'
...@@ -317,9 +315,9 @@ class ChoiceGroupTemplateTest(TemplateTestCase): ...@@ -317,9 +315,9 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
""" """
conditions = [ conditions = [
{'input_type': 'radio', 'status': Status('unsubmitted'), 'question_label': '', 'value': ''}, {'input_type': 'radio', 'status': Status('unsubmitted'), 'value': ''},
{'input_type': 'radio', 'status': Status('unsubmitted'), 'question_label': '', 'value': []}, {'input_type': 'radio', 'status': Status('unsubmitted'), 'value': []},
{'input_type': 'checkbox', 'status': Status('unsubmitted'), 'question_label': '', 'value': []}, {'input_type': 'checkbox', 'status': Status('unsubmitted'), 'value': []},
# These tests expose bug #365 # These tests expose bug #365
# When the bug is fixed, uncomment these cases. # When the bug is fixed, uncomment these cases.
...@@ -343,8 +341,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase): ...@@ -343,8 +341,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
def test_label(self): def test_label(self):
xml = self.render_to_xml(self.context) xml = self.render_to_xml(self.context)
xpath = "//fieldset/legend" xpath = "//fieldset[@aria-label='%s']" % self.context['label']
self.assert_has_text(xml, xpath, self.context['question_label']) self.assert_has_xpath(xml, xpath, self.context)
class TextlineTemplateTest(TemplateTestCase): class TextlineTemplateTest(TemplateTestCase):
...@@ -927,7 +925,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase): ...@@ -927,7 +925,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked correct.""" (not the entire problem) is marked correct."""
conditions = [ conditions = [
{'input_type': 'radio', 'question_label': '', 'value': self.VALUE_DICT}] {'input_type': 'radio', 'value': self.VALUE_DICT}]
self.context['status'] = 'correct' self.context['status'] = 'correct'
...@@ -947,7 +945,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase): ...@@ -947,7 +945,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked incorrect.""" (not the entire problem) is marked incorrect."""
conditions = [ conditions = [
{'input_type': 'radio', 'question_label': '', 'value': self.VALUE_DICT}] {'input_type': 'radio', 'value': self.VALUE_DICT}]
self.context['status'] = 'incorrect' self.context['status'] = 'incorrect'
......
...@@ -61,7 +61,6 @@ class OptionInputTest(unittest.TestCase): ...@@ -61,7 +61,6 @@ class OptionInputTest(unittest.TestCase):
'value': 'Down', 'value': 'Down',
'options': [('Up', 'Up'), ('Down', 'Down'), ('Don\'t know', 'Don\'t know')], 'options': [('Up', 'Up'), ('Down', 'Down'), ('Don\'t know', 'Don\'t know')],
'status': inputtypes.Status('answered'), 'status': inputtypes.Status('answered'),
'question_label': '',
'label': '', 'label': '',
'msg': '', 'msg': '',
'inline': False, 'inline': False,
...@@ -122,7 +121,6 @@ class ChoiceGroupTest(unittest.TestCase): ...@@ -122,7 +121,6 @@ class ChoiceGroupTest(unittest.TestCase):
'id': 'sky_input', 'id': 'sky_input',
'value': 'foil3', 'value': 'foil3',
'status': inputtypes.Status('answered'), 'status': inputtypes.Status('answered'),
'question_label': '',
'label': '', 'label': '',
'msg': '', 'msg': '',
'input_type': expected_input_type, 'input_type': expected_input_type,
...@@ -176,7 +174,6 @@ class JavascriptInputTest(unittest.TestCase): ...@@ -176,7 +174,6 @@ class JavascriptInputTest(unittest.TestCase):
'STATIC_URL': '/dummy-static/', 'STATIC_URL': '/dummy-static/',
'id': 'prob_1_2', 'id': 'prob_1_2',
'status': inputtypes.Status('unanswered'), 'status': inputtypes.Status('unanswered'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': '', 'msg': '',
'value': '3', 'value': '3',
...@@ -210,7 +207,6 @@ class TextLineTest(unittest.TestCase): ...@@ -210,7 +207,6 @@ class TextLineTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'BumbleBee', 'value': 'BumbleBee',
'status': inputtypes.Status('unanswered'), 'status': inputtypes.Status('unanswered'),
'question_label': '',
'label': 'testing 123', 'label': 'testing 123',
'size': size, 'size': size,
'msg': '', 'msg': '',
...@@ -243,7 +239,6 @@ class TextLineTest(unittest.TestCase): ...@@ -243,7 +239,6 @@ class TextLineTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'BumbleBee', 'value': 'BumbleBee',
'status': inputtypes.Status('unanswered'), 'status': inputtypes.Status('unanswered'),
'question_label': '',
'label': '', 'label': '',
'size': size, 'size': size,
'msg': '', 'msg': '',
...@@ -288,7 +283,6 @@ class TextLineTest(unittest.TestCase): ...@@ -288,7 +283,6 @@ class TextLineTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'BumbleBee', 'value': 'BumbleBee',
'status': inputtypes.Status('unanswered'), 'status': inputtypes.Status('unanswered'),
'question_label': '',
'label': '', 'label': '',
'size': size, 'size': size,
'msg': '', 'msg': '',
...@@ -330,7 +324,6 @@ class FileSubmissionTest(unittest.TestCase): ...@@ -330,7 +324,6 @@ class FileSubmissionTest(unittest.TestCase):
'STATIC_URL': '/dummy-static/', 'STATIC_URL': '/dummy-static/',
'id': 'prob_1_2', 'id': 'prob_1_2',
'status': inputtypes.Status('queued'), 'status': inputtypes.Status('queued'),
'question_label': '',
'label': '', 'label': '',
'msg': the_input.submitted_msg, 'msg': the_input.submitted_msg,
'value': 'BumbleBee.py', 'value': 'BumbleBee.py',
...@@ -381,7 +374,6 @@ class CodeInputTest(unittest.TestCase): ...@@ -381,7 +374,6 @@ class CodeInputTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'status': inputtypes.Status('queued'), 'status': inputtypes.Status('queued'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': the_input.submitted_msg, 'msg': the_input.submitted_msg,
'mode': mode, 'mode': mode,
...@@ -437,7 +429,6 @@ class MatlabTest(unittest.TestCase): ...@@ -437,7 +429,6 @@ class MatlabTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'status': inputtypes.Status('queued'), 'status': inputtypes.Status('queued'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': self.the_input.submitted_msg, 'msg': self.the_input.submitted_msg,
'mode': self.mode, 'mode': self.mode,
...@@ -469,7 +460,6 @@ class MatlabTest(unittest.TestCase): ...@@ -469,7 +460,6 @@ class MatlabTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'status': inputtypes.Status('queued'), 'status': inputtypes.Status('queued'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': the_input.submitted_msg, 'msg': the_input.submitted_msg,
'mode': self.mode, 'mode': self.mode,
...@@ -501,7 +491,6 @@ class MatlabTest(unittest.TestCase): ...@@ -501,7 +491,6 @@ class MatlabTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'status': inputtypes.Status(status), 'status': inputtypes.Status(status),
'question_label': '',
# 'label': '', # 'label': '',
'msg': '', 'msg': '',
'mode': self.mode, 'mode': self.mode,
...@@ -533,7 +522,6 @@ class MatlabTest(unittest.TestCase): ...@@ -533,7 +522,6 @@ class MatlabTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'status': inputtypes.Status('queued'), 'status': inputtypes.Status('queued'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': the_input.submitted_msg, 'msg': the_input.submitted_msg,
'mode': self.mode, 'mode': self.mode,
...@@ -660,14 +648,7 @@ class MatlabTest(unittest.TestCase): ...@@ -660,14 +648,7 @@ class MatlabTest(unittest.TestCase):
output = self.the_input.get_html() output = self.the_input.get_html()
self.assertEqual( self.assertEqual(
etree.tostring(output), etree.tostring(output),
" ".join(textwrap.dedent(""" """<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>"""
<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())
) )
# test html, that is correct HTML5 html, but is not parsable by XML parser. # test html, that is correct HTML5 html, but is not parsable by XML parser.
...@@ -758,7 +739,6 @@ class MatlabTest(unittest.TestCase): ...@@ -758,7 +739,6 @@ class MatlabTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'print "good evening"', 'value': 'print "good evening"',
'status': inputtypes.Status('queued'), 'status': inputtypes.Status('queued'),
'question_label': '',
'msg': self.the_input.submitted_msg, 'msg': self.the_input.submitted_msg,
'mode': self.mode, 'mode': self.mode,
'rows': self.rows, 'rows': self.rows,
...@@ -868,7 +848,6 @@ class SchematicTest(unittest.TestCase): ...@@ -868,7 +848,6 @@ class SchematicTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': value, 'value': value,
'status': inputtypes.Status('unsubmitted'), 'status': inputtypes.Status('unsubmitted'),
'question_label': '',
'label': '', 'label': '',
'msg': '', 'msg': '',
'initial_value': initial_value, 'initial_value': initial_value,
...@@ -913,7 +892,6 @@ class ImageInputTest(unittest.TestCase): ...@@ -913,7 +892,6 @@ class ImageInputTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': value, 'value': value,
'status': inputtypes.Status('unsubmitted'), 'status': inputtypes.Status('unsubmitted'),
'question_label': '',
'label': '', 'label': '',
'width': width, 'width': width,
'height': height, 'height': height,
...@@ -969,7 +947,6 @@ class CrystallographyTest(unittest.TestCase): ...@@ -969,7 +947,6 @@ class CrystallographyTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': value, 'value': value,
'status': inputtypes.Status('unsubmitted'), 'status': inputtypes.Status('unsubmitted'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': '', 'msg': '',
'width': width, 'width': width,
...@@ -1012,7 +989,6 @@ class VseprTest(unittest.TestCase): ...@@ -1012,7 +989,6 @@ class VseprTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': value, 'value': value,
'status': inputtypes.Status('unsubmitted'), 'status': inputtypes.Status('unsubmitted'),
'question_label': '',
'msg': '', 'msg': '',
'width': width, 'width': width,
'height': height, 'height': height,
...@@ -1046,7 +1022,6 @@ class ChemicalEquationTest(unittest.TestCase): ...@@ -1046,7 +1022,6 @@ class ChemicalEquationTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'H2OYeah', 'value': 'H2OYeah',
'status': inputtypes.Status('unanswered'), 'status': inputtypes.Status('unanswered'),
'question_label': '',
'label': '', 'label': '',
'msg': '', 'msg': '',
'size': self.size, 'size': self.size,
...@@ -1136,7 +1111,6 @@ class FormulaEquationTest(unittest.TestCase): ...@@ -1136,7 +1111,6 @@ class FormulaEquationTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': 'x^2+1/2', 'value': 'x^2+1/2',
'status': inputtypes.Status('unanswered'), 'status': inputtypes.Status('unanswered'),
'question_label': '',
'label': '', 'label': '',
'msg': '', 'msg': '',
'size': self.size, 'size': self.size,
...@@ -1266,7 +1240,6 @@ class DragAndDropTest(unittest.TestCase): ...@@ -1266,7 +1240,6 @@ class DragAndDropTest(unittest.TestCase):
'id': 'prob_1_2', 'id': 'prob_1_2',
'value': value, 'value': value,
'status': inputtypes.Status('unsubmitted'), 'status': inputtypes.Status('unsubmitted'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': '', 'msg': '',
'drag_and_drop_json': json.dumps(user_input) 'drag_and_drop_json': json.dumps(user_input)
...@@ -1319,7 +1292,6 @@ class AnnotationInputTest(unittest.TestCase): ...@@ -1319,7 +1292,6 @@ class AnnotationInputTest(unittest.TestCase):
'STATIC_URL': '/dummy-static/', 'STATIC_URL': '/dummy-static/',
'id': 'annotation_input', 'id': 'annotation_input',
'status': inputtypes.Status('answered'), 'status': inputtypes.Status('answered'),
'question_label': '',
# 'label': '', # 'label': '',
'msg': '', 'msg': '',
'title': 'foo', 'title': 'foo',
...@@ -1396,7 +1368,6 @@ class TestChoiceText(unittest.TestCase): ...@@ -1396,7 +1368,6 @@ class TestChoiceText(unittest.TestCase):
expected = { expected = {
'STATIC_URL': '/dummy-static/', 'STATIC_URL': '/dummy-static/',
'msg': '', 'msg': '',
'question_label': '',
'label': '', 'label': '',
'input_type': expected_input_type, 'input_type': expected_input_type,
'choices': choices, 'choices': choices,
......
...@@ -509,7 +509,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -509,7 +509,7 @@ describe 'MarkdownEditingDescriptor', ->
[Explanation] [Explanation]
""") """)
expect(data).toEqual("""<problem> 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" > <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"/> <textline label="Who lead the civil right movement in the United States of America?" size="20"/>
</stringresponse> </stringresponse>
...@@ -541,14 +541,14 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -541,14 +541,14 @@ describe 'MarkdownEditingDescriptor', ->
expect(data).toEqual("""<problem> expect(data).toEqual("""<problem>
<p>France is a country in Europe.</p> <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" > <stringresponse answer="Paris" type="ci" >
<textline label="What is the capital of France?" size="20"/> <textline label="What is the capital of France?" size="20"/>
</stringresponse> </stringresponse>
<p>Germany is a country in Europe, too.</p> <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> <multiplechoiceresponse>
<choicegroup label="What is the capital of Germany?" type="MultipleChoice"> <choicegroup label="What is the capital of Germany?" type="MultipleChoice">
<choice correct="false">Bonn</choice> <choice correct="false">Bonn</choice>
...@@ -574,12 +574,11 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -574,12 +574,11 @@ describe 'MarkdownEditingDescriptor', ->
( ) Hamburg ( ) Hamburg
(x) Berlin (x) Berlin
( ) Donut ( ) Donut
""") """)
expect(data).toEqual("""<problem> expect(data).toEqual("""<problem>
<p>France is a country in Europe.</p> <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" > <stringresponse answer="Paris" type="ci" >
<textline label="What is the capital of France?" size="20"/> <textline label="What is the capital of France?" size="20"/>
</stringresponse> </stringresponse>
...@@ -595,8 +594,8 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -595,8 +594,8 @@ describe 'MarkdownEditingDescriptor', ->
<choice correct="false">Donut</choice> <choice correct="false">Donut</choice>
</choicegroup> </choicegroup>
</multiplechoiceresponse> </multiplechoiceresponse>
</problem>""") </problem>""")
it 'tests malformed labels', -> it 'tests malformed labels', ->
data = MarkdownEditingDescriptor.markdownToXml(""" data = MarkdownEditingDescriptor.markdownToXml("""
...@@ -605,7 +604,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -605,7 +604,7 @@ describe 'MarkdownEditingDescriptor', ->
>>What is the capital of France?< >>What is the capital of France?<
= Paris = Paris
>>What is the capital of <<Germany?<< blah>>What is the capital of <<Germany?<<
( ) Bonn ( ) Bonn
( ) Hamburg ( ) Hamburg
(x) Berlin (x) Berlin
...@@ -619,7 +618,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -619,7 +618,7 @@ describe 'MarkdownEditingDescriptor', ->
<textline size="20"/> <textline size="20"/>
</stringresponse> </stringresponse>
<legend>What is the capital of Germany?</legend> <p>blahWhat is the capital of Germany?</p>
<multiplechoiceresponse> <multiplechoiceresponse>
<choicegroup label="What is the capital of &lt;&lt;Germany?" type="MultipleChoice"> <choicegroup label="What is the capital of &lt;&lt;Germany?" type="MultipleChoice">
<choice correct="false">Bonn</choice> <choice correct="false">Bonn</choice>
...@@ -637,7 +636,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -637,7 +636,7 @@ describe 'MarkdownEditingDescriptor', ->
= 3.14159 +- .02 = 3.14159 +- .02
""") """)
expect(data).toEqual("""<problem> expect(data).toEqual("""<problem>
<legend>Enter the numerical value of Pi:</legend> <p>Enter the numerical value of Pi:</p>
<numericalresponse answer="3.14159"> <numericalresponse answer="3.14159">
<responseparam type="tolerance" default=".02" /> <responseparam type="tolerance" default=".02" />
<formulaequationinput label="Enter the numerical value of Pi:" /> <formulaequationinput label="Enter the numerical value of Pi:" />
...@@ -651,7 +650,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -651,7 +650,7 @@ describe 'MarkdownEditingDescriptor', ->
= Paris = Paris
""") """)
expect(data).toEqual("""<problem> 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" > <stringresponse answer="Paris" type="ci" >
<textline label="What is the &quot;capital&quot; of France &amp; the &apos;best&apos; &gt; place &lt; to live&quot;?" size="20"/> <textline label="What is the &quot;capital&quot; of France &amp; the &apos;best&apos; &gt; place &lt; to live&quot;?" size="20"/>
</stringresponse> </stringresponse>
......
...@@ -371,9 +371,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor ...@@ -371,9 +371,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
.replace(/>/g, '&gt;') .replace(/>/g, '&gt;')
.replace(/"/g, '&quot;') .replace(/"/g, '&quot;')
.replace(/'/g, '&apos;'); .replace(/'/g, '&apos;');
line = line.replace(/>>/g, '<legend>'); line = line.replace(/>>|<</g, '');
line = line.replace(/<+$/g, '</legend>');
line = line.replace(/<</g, '');
} else if (line.match(/<\w+response/) && didinput && curlabel == prevlabel) { } else if (line.match(/<\w+response/) && didinput && curlabel == prevlabel) {
// reset label to prevent gobbling up previous one (if multiple questions) // reset label to prevent gobbling up previous one (if multiple questions)
curlabel = ''; curlabel = '';
......
...@@ -16,7 +16,6 @@ metadata: ...@@ -16,7 +16,6 @@ metadata:
[x] French [x] French
[ ] Hungarian [ ] Hungarian
Note: Make sure you select all of the correct options—there may be more than one! Note: Make sure you select all of the correct options—there may be more than one!
[explanation] [explanation]
...@@ -29,16 +28,18 @@ data: | ...@@ -29,16 +28,18 @@ data: |
<p>When you add the component, be sure to select <strong>Settings</strong> <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> 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> <p>You can use the following example problem as a model.</p>
<legend>The following languages are in the Indo-European family:</legend> <fieldset>
<choiceresponse> <legend>The following languages are in the Indo-European family:</legend>
<checkboxgroup direction="vertical"> <choiceresponse>
<choice correct="true" name="urdu">Urdu</choice> <checkboxgroup direction="vertical">
<choice correct="false" name="finnish">Finnish</choice> <choice correct="true" name="urdu">Urdu</choice>
<choice correct="true" name="marathi">Marathi</choice> <choice correct="false" name="finnish">Finnish</choice>
<choice correct="true" name="french">French</choice> <choice correct="true" name="marathi">Marathi</choice>
<choice correct="false" name="hungarian">Hungarian</choice> <choice correct="true" name="french">French</choice>
</checkboxgroup> <choice correct="false" name="hungarian">Hungarian</choice>
</choiceresponse> </checkboxgroup>
</choiceresponse>
</fieldset>
<p><strong>Note</strong>: Make sure you select all of the correct options—there may be more than one!</p> <p><strong>Note</strong>: Make sure you select all of the correct options—there may be more than one!</p>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
......
...@@ -15,7 +15,6 @@ metadata: ...@@ -15,7 +15,6 @@ metadata:
(x) Indonesia (x) Indonesia
( ) Russia ( ) Russia
[explanation] [explanation]
According to September 2014 estimates: According to September 2014 estimates:
The population of Indonesia is approximately 250 million. The population of Indonesia is approximately 250 million.
...@@ -31,6 +30,7 @@ data: | ...@@ -31,6 +30,7 @@ data: |
<p>When you add the problem, be sure to select <strong>Settings</strong> <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> 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> <p>You can use the following example problem as a model.</p>
<fieldset>
<legend>Which of the following countries has the largest population?</legend> <legend>Which of the following countries has the largest population?</legend>
<multiplechoiceresponse> <multiplechoiceresponse>
<choicegroup type="MultipleChoice"> <choicegroup type="MultipleChoice">
...@@ -40,6 +40,7 @@ data: | ...@@ -40,6 +40,7 @@ data: |
<choice correct="false" name="russia">Russia</choice> <choice correct="false" name="russia">Russia</choice>
</choicegroup> </choicegroup>
</multiplechoiceresponse> </multiplechoiceresponse>
</fieldset>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
<p>Explanation</p> <p>Explanation</p>
......
...@@ -14,12 +14,11 @@ metadata: ...@@ -14,12 +14,11 @@ metadata:
>>How many miles away from Earth is the sun? Use scientific notation to answer.<< >>How many miles away from Earth is the sun? Use scientific notation to answer.<<
= 9.3*10^6 = 9.3*10^6
or= 9.296*10^6 or= 9.296*10^6
>>The square of what number is -100?<< >>The square of what number is -100?<<
= 10*i = 10*i
[explanation] [explanation]
The sun is 93,000,000, or 9.3*10^6, miles away from Earth. The sun is 93,000,000, or 9.3*10^6, miles away from Earth.
......
...@@ -14,7 +14,6 @@ metadata: ...@@ -14,7 +14,6 @@ metadata:
[[(India), Spain, China, Bermuda]] [[(India), Spain, China, Bermuda]]
[explanation] [explanation]
India became an independent nation on August 15, 1947. India became an independent nation on August 15, 1947.
[explanation] [explanation]
......
...@@ -14,7 +14,7 @@ metadata: ...@@ -14,7 +14,7 @@ metadata:
= Nanjing Higher Normal Institute = Nanjing Higher Normal Institute
or= National Central University or= National Central University
or= Nanjing University or= Nanjing University
[explanation] [explanation]
Nanjing Higher Normal Institute first admitted female students in 1920. Nanjing Higher Normal Institute first admitted female students in 1920.
[explanation] [explanation]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment