summaryrefslogtreecommitdiff
path: root/tests/test_ext_math.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-04 22:23:28 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-07 02:12:07 +0900
commitaf4e615a8a25c15df844cf51a2eb2647111bd472 (patch)
tree286bfd6736d7971eaa9a51f7b07cad2dee34417c /tests/test_ext_math.py
parentac7d574fceddd5dfbedea53af499080f39710aa6 (diff)
downloadsphinx-git-af4e615a8a25c15df844cf51a2eb2647111bd472.tar.gz
Close #6241: html: Allow to add JS/CSS files to the specific page
Allow to add JS/CSS files to the specific page when an extension calls `app.add_js_file()` or `app.add_css_file()` on `html-page-context` event.
Diffstat (limited to 'tests/test_ext_math.py')
-rw-r--r--tests/test_ext_math.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py
index 28c2c35a5..10c8c4866 100644
--- a/tests/test_ext_math.py
+++ b/tests/test_ext_math.py
@@ -15,6 +15,7 @@ import warnings
import pytest
from docutils import nodes
+from sphinx.ext.mathjax import MATHJAX_URL
from sphinx.testing.util import assert_node
@@ -224,6 +225,18 @@ def test_mathjax_config(app, status, warning):
'</script>' 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()
+
+ content = (app.outdir / 'index.html').read_text()
+ assert MATHJAX_URL in content
+
+ content = (app.outdir / 'nomath.html').read_text()
+ assert MATHJAX_URL not in content
+
+
@pytest.mark.sphinx('html', testroot='basic',
confoverrides={'extensions': ['sphinx.ext.mathjax']})
def test_mathjax_is_not_installed_if_no_equations(app, status, warning):