Skip to content

Commit bc6c720

Browse files
committed
Test for hoverxref_ignore_refs
1 parent 557e1f5 commit bc6c720

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_htmltag.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,32 @@ def test_python_domain(app, status, warning):
169169

170170
for chunk in chunks:
171171
assert chunk in content
172+
173+
174+
@pytest.mark.sphinx(
175+
srcdir=srcdir,
176+
confoverrides={
177+
'hoverxref_ignore_refs': [
178+
'section i',
179+
],
180+
},
181+
)
182+
def test_ignore_refs(app, status, warning):
183+
app.build()
184+
path = app.outdir / 'index.html'
185+
assert path.exists() is True
186+
content = open(path).read()
187+
188+
chunks = [
189+
'<a class="reference internal" href="chapter-i.html#chapter-i"><span class="std std-ref">This a :ref: to Chapter I</span></a>',
190+
'<a class="reference internal" href="chapter-i.html#section-i"><span class="std std-ref">This a :hoverxref: to Chapter I, Section I</span></a>',
191+
]
192+
193+
for chunk in chunks:
194+
assert chunk in content
195+
196+
ignored_chunks = [
197+
'<a class="hoverxref reference internal" data-doc="chapter-i" data-project="myproject" data-section="section-i" data-version="myversion" href="chapter-i.html#section-i"><span class="std std-ref">This a :hoverxref: to Chapter I, Section I</span></a>',
198+
]
199+
for chunk in ignored_chunks:
200+
assert chunk not in content

0 commit comments

Comments
 (0)