diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2021-05-06 15:10:06 +0200 |
---|---|---|
committer | Manuel Kaufmann <humitos@gmail.com> | 2021-05-06 15:21:12 +0200 |
commit | d01e776c814a3f9eaa479ec7eb63fb4fc33a0143 (patch) | |
tree | 91537e6414033623575420c52d2a22d983e45269 /tests/test_ext_math.py | |
parent | 512743525c64ef880ef02116fe3890ed29339bd4 (diff) | |
download | sphinx-git-d01e776c814a3f9eaa479ec7eb63fb4fc33a0143.tar.gz |
Add `Sphinx.add_html_assets_in_all_pages`
This new method in the `Sphinx` object allows extensions to communicate to
Sphinx that it's preferred to include HTML assets in all the pages. However,
it's extensions developers' responsability to follow this config and decide
whether or not include the assets required.
Extensions developers' can check `Sphinx.html_assets_in_all_pages` together with
any other logic they may have to decide if the assets will be included in the
rendered page or not.
Closes #9115
Diffstat (limited to 'tests/test_ext_math.py')
-rw-r--r-- | tests/test_ext_math.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py index ebe2c0f38..52d49ec43 100644 --- a/tests/test_ext_math.py +++ b/tests/test_ext_math.py @@ -256,3 +256,16 @@ def test_mathjax_is_not_installed_if_no_equations(app, status, warning): content = (app.outdir / 'index.html').read_text() assert 'MathJax.js' not in content + + +@pytest.mark.sphinx('html', testroot='ext-math', + confoverrides={'extensions': ['sphinx.ext.mathjax']}) +def test_mathjax_is_installed_if_no_equations_when_forced(app, status, warning): + app.add_html_assets_in_all_pages() + app.builder.build_all() + + content = (app.outdir / 'index.html').read_text() + assert MATHJAX_URL in content + + content = (app.outdir / 'nomath.html').read_text() + assert MATHJAX_URL in content |