Commit ded3786d by Awais Jibran

Merge pull request #11157 from edx/aj/tnl3968-mathjax-in-static-pages

Enable MathJax in Course Pages
parents 65cec380 a72d4a04
...@@ -36,6 +36,16 @@ class TabNavPage(PageObject): ...@@ -36,6 +36,16 @@ class TabNavPage(PageObject):
self.wait_for_page() self.wait_for_page()
self._is_on_tab_promise(tab_name).fulfill() self._is_on_tab_promise(tab_name).fulfill()
def mathjax_has_rendered(self):
"""
Check that MathJax has rendered in tab content
"""
mathjax_container = self.q(css=".static_tab_wrapper .MathJax .math")
EmptyPromise(
lambda: mathjax_container.present and mathjax_container.visible,
"MathJax is not visible"
).fulfill()
def is_on_tab(self, tab_name): def is_on_tab(self, tab_name):
""" """
Return a boolean indicating whether the current tab is `tab_name`. Return a boolean indicating whether the current tab is `tab_name`.
......
...@@ -571,7 +571,7 @@ class HighLevelTabTest(UniqueCourseTest): ...@@ -571,7 +571,7 @@ class HighLevelTabTest(UniqueCourseTest):
course_fix.add_handout('demoPDF.pdf') course_fix.add_handout('demoPDF.pdf')
course_fix.add_children( course_fix.add_children(
XBlockFixtureDesc('static_tab', 'Test Static Tab'), XBlockFixtureDesc('static_tab', 'Test Static Tab', data=r"static tab data with mathjax \(E=mc^2\)"),
XBlockFixtureDesc('chapter', 'Test Section').add_children( XBlockFixtureDesc('chapter', 'Test Section').add_children(
XBlockFixtureDesc('sequential', 'Test Subsection').add_children( XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
XBlockFixtureDesc('problem', 'Test Problem 1', data=load_data_str('multiple_choice.xml')), XBlockFixtureDesc('problem', 'Test Problem 1', data=load_data_str('multiple_choice.xml')),
...@@ -631,6 +631,18 @@ class HighLevelTabTest(UniqueCourseTest): ...@@ -631,6 +631,18 @@ class HighLevelTabTest(UniqueCourseTest):
self.tab_nav.go_to_tab('Test Static Tab') self.tab_nav.go_to_tab('Test Static Tab')
self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab')) self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab'))
def test_static_tab_with_mathjax(self):
"""
Navigate to a static tab (course content)
"""
# From the course info page, navigate to the static tab
self.course_info_page.visit()
self.tab_nav.go_to_tab('Test Static Tab')
self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab'))
# Verify that Mathjax has rendered
self.tab_nav.mathjax_has_rendered()
def test_wiki_tab_first_time(self): def test_wiki_tab_first_time(self):
""" """
Navigate to the course wiki tab. When the wiki is accessed for Navigate to the course wiki tab. When the wiki is accessed for
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
<%static:css group='style-course-vendor'/> <%static:css group='style-course-vendor'/>
<%static:css group='style-course'/> <%static:css group='style-course'/>
</%block> </%block>
<%block name="js_extra">
<%include file="/mathjax_include.html" args="disable_fast_preview=True"/>
</%block>
<%block name="pagetitle">${tab['name']} | ${course.display_number_with_default | h}</%block> <%block name="pagetitle">${tab['name']} | ${course.display_number_with_default | h}</%block>
......
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