Commit 34ab38d7 by Noraiz Anwar Committed by Noraiz

Fix mathjax rendering

TNL-5451
parent dda92d13
......@@ -384,10 +384,9 @@
} else if (RE_DISPLAYMATH.test(htmlString)) {
htmlString = htmlString.replace(RE_DISPLAYMATH, function($0, $1, $2, $3) {
/*
bug fix, ordering is off
corrected mathjax rendering in preview
*/
processedHtmlString = processor('$$' + $2 + '$$', 'display') + processedHtmlString;
processedHtmlString = $1 + processedHtmlString;
processedHtmlString += $1 + processor('$$' + $2 + '$$', 'display');
return $3;
});
} else {
......
......@@ -758,3 +758,11 @@ class DiscussionTabHomePage(CoursePage, DiscussionPageMixin):
"""
self.wait_for_element_visibility(".wmd-preview > *", "WMD preview pane has contents", timeout=10)
return self.q(css=".wmd-preview").html[0]
def get_new_post_preview_text(self):
"""
Get the rendered preview of the contents of the Discussions new post editor
Waits for content to appear, as the preview is triggered on debounced/delayed onchange
"""
self.wait_for_element_visibility(".wmd-preview > div", "WMD preview pane has contents", timeout=10)
return self.q(css=".wmd-preview").text[0]
......@@ -959,6 +959,22 @@ class DiscussionEditorPreviewTest(UniqueCourseTest):
"</ul>"
))
def test_mathjax_rendering_in_order(self):
"""
Tests that mathjax is rendered in proper order.
When user types mathjax expressions into discussion editor, it should render in the proper
order.
"""
self.page.set_new_post_editor_value(
'Text line 1 \n'
'$$e[n]=d_1$$ \n'
'Text line 2 \n'
'$$e[n]=d_2$$'
)
self.assertEqual(self.page.get_new_post_preview_text(), 'Text line 1\nText line 2')
@attr(shard=2)
class InlineDiscussionTest(UniqueCourseTest, DiscussionResponsePaginationTestMixin):
......
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