summaryrefslogtreecommitdiff
path: root/tests/test_build_html.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-01-01 19:02:09 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2022-01-01 19:02:09 +0900
commit6ee3dd196813ca7bbf91105d0d6e563ea1fcd202 (patch)
tree27dd861f5752e3306ef2b0de7dd21e9ce43d88a0 /tests/test_build_html.py
parentd62220676d38f8d588fb59f92c3169385e94ad00 (diff)
parentb22134dcd35c9cffd5c8fe5a3f5224fcb3d3741f (diff)
downloadsphinx-git-6ee3dd196813ca7bbf91105d0d6e563ea1fcd202.tar.gz
Merge branch '4.x'
Diffstat (limited to 'tests/test_build_html.py')
-rw-r--r--tests/test_build_html.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index a1d4717e7..d2437a4dd 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -1195,6 +1195,20 @@ def test_assets_order(app):
assert re.search(pattern, content, re.S)
+@pytest.mark.sphinx('html', testroot='html_assets')
+def test_javscript_loading_method(app):
+ app.add_js_file('normal.js')
+ app.add_js_file('early.js', loading_method='async')
+ app.add_js_file('late.js', loading_method='defer')
+
+ app.builder.build_all()
+ content = (app.outdir / 'index.html').read_text()
+
+ assert '<script src="_static/normal.js"></script>' in content
+ assert '<script async="async" src="_static/early.js"></script>' in content
+ assert '<script defer="defer" src="_static/late.js"></script>' in content
+
+
@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_copy_source': False})
def test_html_copy_source(app):
app.builder.build_all()