mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: Add testcase for mathjax3_config (refs: #9094)
This commit is contained in:
parent
7e7126a4a8
commit
4582d5a396
@ -1166,7 +1166,11 @@ def setup_js_tag_helper(app: Sphinx, pagename: str, templatename: str,
|
||||
else:
|
||||
# str value (old styled)
|
||||
attrs.append('src="%s"' % pathto(js, resource=True))
|
||||
return '<script %s>%s</script>' % (' '.join(attrs), body)
|
||||
|
||||
if attrs:
|
||||
return '<script %s>%s</script>' % (' '.join(attrs), body)
|
||||
else:
|
||||
return '<script>%s</script>' % body
|
||||
|
||||
context['js_tag'] = js_tag
|
||||
|
||||
|
@ -215,11 +215,23 @@ def test_math_compat(app, status, warning):
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-math',
|
||||
confoverrides={'extensions': ['sphinx.ext.mathjax'],
|
||||
'mathjax_config': {'extensions': ['tex2jax.js']}})
|
||||
def test_mathjax_config(app, status, warning):
|
||||
'mathjax3_config': {'extensions': ['tex2jax.js']}})
|
||||
def test_mathjax3_config(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'index.html').read_text()
|
||||
assert MATHJAX_URL in content
|
||||
assert ('<script>window.MathJax = {"extensions": ["tex2jax.js"]}</script>' in content)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-math',
|
||||
confoverrides={'extensions': ['sphinx.ext.mathjax'],
|
||||
'mathjax2_config': {'extensions': ['tex2jax.js']}})
|
||||
def test_mathjax2_config(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'index.html').read_text()
|
||||
assert MATHJAX_URL in content
|
||||
assert ('<script type="text/x-mathjax-config">'
|
||||
'MathJax.Hub.Config({"extensions": ["tex2jax.js"]})'
|
||||
'</script>' in content)
|
||||
|
Loading…
Reference in New Issue
Block a user