diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-11-23 13:17:01 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-23 13:17:01 +0900 |
| commit | 538e28149513aa7a03ac2f269f700bcce693ed77 (patch) | |
| tree | 1275b75cc1e98aba626c4d6eab8ded4009963bcf /tests/test_ext_math.py | |
| parent | ccfa7c7a1b90ac5bca4603270834d18aee3e8cbb (diff) | |
| parent | 5e6253ed3c1346ff04440f0af41aec6ce491b2d1 (diff) | |
| download | sphinx-git-538e28149513aa7a03ac2f269f700bcce693ed77.tar.gz | |
Merge pull request #9867 from tk0miya/9864_mathjax_loading_method
Fix #9864: mathjax: Failed to render equations via MathJax v2
Diffstat (limited to 'tests/test_ext_math.py')
| -rw-r--r-- | tests/test_ext_math.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py index 7c78954b7..175c9e0f5 100644 --- a/tests/test_ext_math.py +++ b/tests/test_ext_math.py @@ -71,7 +71,7 @@ def test_mathjax_options(app, status, warning): app.builder.build_all() content = (app.outdir / 'index.html').read_text() - assert ('<script defer="defer" integrity="sha384-0123456789" ' + assert ('<script async="async" integrity="sha384-0123456789" ' 'src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">' '</script>' in content) @@ -221,6 +221,7 @@ def test_mathjax3_config(app, status, warning): content = (app.outdir / 'index.html').read_text() assert MATHJAX_URL in content + assert ('<script defer="defer" src="%s">' % MATHJAX_URL in content) assert ('<script>window.MathJax = {"extensions": ["tex2jax.js"]}</script>' in content) @@ -231,13 +232,36 @@ 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 async="async" src="%s">' % MATHJAX_URL in content) assert ('<script type="text/x-mathjax-config">' 'MathJax.Hub.Config({"extensions": ["tex2jax.js"]})' '</script>' in content) @pytest.mark.sphinx('html', testroot='ext-math', + confoverrides={'extensions': ['sphinx.ext.mathjax'], + 'mathjax_options': {'async': 'async'}, + 'mathjax3_config': {'extensions': ['tex2jax.js']}}) +def test_mathjax_options_async_for_mathjax3(app, status, warning): + app.builder.build_all() + + content = (app.outdir / 'index.html').read_text() + assert MATHJAX_URL in content + assert ('<script async="async" src="%s">' % MATHJAX_URL in content) + + +@pytest.mark.sphinx('html', testroot='ext-math', + confoverrides={'extensions': ['sphinx.ext.mathjax'], + 'mathjax_options': {'defer': 'defer'}, + 'mathjax2_config': {'extensions': ['tex2jax.js']}}) +def test_mathjax_options_defer_for_mathjax2(app, status, warning): + app.builder.build_all() + + content = (app.outdir / 'index.html').read_text() + assert ('<script defer="defer" src="%s">' % MATHJAX_URL in content) + + +@pytest.mark.sphinx('html', testroot='ext-math', confoverrides={'extensions': ['sphinx.ext.mathjax']}) def test_mathjax_is_installed_only_if_document_having_math(app, status, warning): app.builder.build_all() |
