Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/lib/capa/capa/capa_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

# These should be removed from HTML output, including all subelements
html_problem_semantics = [
"additional_answer",
"codeparam",
"responseparam",
"answer",
Expand Down
17 changes: 17 additions & 0 deletions common/lib/capa/capa/tests/test_capa_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,23 @@ def test_multiple_descriptions(self):
}
)

def test_additional_answer_is_skipped_from_resulting_html(self):
"""Tests that additional_answer element is not present in transformed HTML"""
xml = """
<problem>
<p>Be sure to check your spelling.</p>
<stringresponse answer="War" type="ci">
<label>___ requires sacrifices.</label>
<description>Anyone who looks the world as if it was a game of chess deserves to lose.</description>
<additional_answer answer="optional acceptable variant of the correct answer"/>
<textline size="40"/>
</stringresponse>
</problem>
"""
problem = new_loncapa_problem(xml)
self.assertEqual(len(problem.extracted_tree.xpath('//additional_answer')), 0)
self.assertNotIn('additional_answer', problem.get_html())

def test_non_accessible_inputtype(self):
"""
Verify that tag with question text is not removed when inputtype is not fully accessible.
Expand Down