diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py index c13567c82d3e..78ae3b4daa92 100644 --- a/common/lib/capa/capa/capa_problem.py +++ b/common/lib/capa/capa/capa_problem.py @@ -60,6 +60,7 @@ # These should be removed from HTML output, including all subelements html_problem_semantics = [ + "additional_answer", "codeparam", "responseparam", "answer", diff --git a/common/lib/capa/capa/tests/test_capa_problem.py b/common/lib/capa/capa/tests/test_capa_problem.py index 59ca1d442144..85016058bb93 100644 --- a/common/lib/capa/capa/tests/test_capa_problem.py +++ b/common/lib/capa/capa/tests/test_capa_problem.py @@ -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 = """ + +

Be sure to check your spelling.

+ + + Anyone who looks the world as if it was a game of chess deserves to lose. + + + +
+ """ + 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.