2024-11-22 15:54:26 -06:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2024-01-17 18:08:30 -06:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.sphinx('html', testroot='theming')
|
2024-07-23 09:35:55 -05:00
|
|
|
def test_theme_options(app):
|
2024-01-17 18:08:30 -06:00
|
|
|
app.build()
|
|
|
|
|
2024-08-11 08:58:56 -05:00
|
|
|
result = (app.outdir / '_static' / 'documentation_options.js').read_text(
|
|
|
|
encoding='utf8'
|
|
|
|
)
|
2024-01-17 18:08:30 -06:00
|
|
|
assert 'NAVIGATION_WITH_KEYS: false' in result
|
|
|
|
assert 'ENABLE_SEARCH_SHORTCUTS: true' in result
|
|
|
|
|
|
|
|
|
2024-03-22 06:57:34 -05:00
|
|
|
@pytest.mark.sphinx(
|
|
|
|
'html',
|
|
|
|
testroot='theming',
|
|
|
|
confoverrides={
|
|
|
|
'html_theme_options.navigation_with_keys': True,
|
|
|
|
'html_theme_options.enable_search_shortcuts': False,
|
|
|
|
},
|
|
|
|
)
|
2024-07-23 09:35:55 -05:00
|
|
|
def test_theme_options_with_override(app):
|
2024-01-17 18:08:30 -06:00
|
|
|
app.build()
|
|
|
|
|
2024-08-11 08:58:56 -05:00
|
|
|
result = (app.outdir / '_static' / 'documentation_options.js').read_text(
|
|
|
|
encoding='utf8'
|
|
|
|
)
|
2024-01-17 18:08:30 -06:00
|
|
|
assert 'NAVIGATION_WITH_KEYS: true' in result
|
|
|
|
assert 'ENABLE_SEARCH_SHORTCUTS: false' in result
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.sphinx('html', testroot='build-html-theme-having-multiple-stylesheets')
|
|
|
|
def test_theme_having_multiple_stylesheets(app):
|
|
|
|
app.build()
|
|
|
|
content = (app.outdir / 'index.html').read_text(encoding='utf-8')
|
|
|
|
|
2024-08-11 08:58:56 -05:00
|
|
|
assert (
|
|
|
|
'<link rel="stylesheet" type="text/css" href="_static/mytheme.css" />'
|
|
|
|
) in content
|
|
|
|
assert (
|
|
|
|
'<link rel="stylesheet" type="text/css" href="_static/extra.css" />'
|
|
|
|
) in content
|