diff --git a/lms/djangoapps/edxnotes/tests.py b/lms/djangoapps/edxnotes/tests.py index 76010b4e2d..cef50f5b1b 100644 --- a/lms/djangoapps/edxnotes/tests.py +++ b/lms/djangoapps/edxnotes/tests.py @@ -998,6 +998,21 @@ class EdxNotesViewsTest(ModuleStoreTestCase): response = self.client.get(self.notes_page_url) self.assertContains(response, 'Highlights and notes you've made in course content') + # pylint: disable=unused-argument + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_EDXNOTES": True}) + @patch("edxnotes.views.get_notes", return_value={'results': []}) + @patch("edxnotes.views.get_course_position", return_value={'display_name': 'Section 1', 'url': 'test_url'}) + def test_edxnotes_html_tags_should_not_be_escaped(self, mock_get_notes, mock_position): + """ + Tests that explicit html tags rendered correctly. + """ + enable_edxnotes_for_the_course(self.course, self.user.id) + response = self.client.get(self.notes_page_url) + self.assertContains( + response, + 'Get started by making a note in something you just read, like Section 1' + ) + @patch.dict("django.conf.settings.FEATURES", {"ENABLE_EDXNOTES": False}) def test_edxnotes_view_is_disabled(self): """ diff --git a/lms/templates/edxnotes/edxnotes.html b/lms/templates/edxnotes/edxnotes.html index 533646c5cd..04a08dacbe 100644 --- a/lms/templates/edxnotes/edxnotes.html +++ b/lms/templates/edxnotes/edxnotes.html @@ -5,6 +5,7 @@ <%! from django.utils.translation import ugettext as _ from edxnotes.helpers import NoteJSONEncoder +from openedx.core.djangolib.markup import Text, HTML from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string %> @@ -78,8 +79,8 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str % if position is not None:
-

${_('Get started by making a note in something you just read, like {section_link}.').format( - section_link='{section_name}'.format( +

${Text(_('Get started by making a note in something you just read, like {section_link}.')).format( + section_link=HTML('{section_name}').format( url=position['url'], section_name=position['display_name'], )