mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-12 16:32:10 -05:00
js domain: Remove extra brackets from function arguments and errors (#13569)
This commit is contained in:
1 parent
4f23c99300
commit
4a3bd13b6a
4 files changed
+28
-6
No files matched your search
@@ -26,6 +26,10 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
from sphinx.writers.text import STDINDENT
|
||||
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
|
||||
|
||||
@pytest.mark.sphinx('dummy', testroot='domain-js')
|
||||
def test_domain_js_xrefs(app):
|
||||
@@ -892,3 +896,19 @@ def test_domain_js_javascript_trailing_comma_in_multi_line_signatures_in_text(ap
|
||||
expected_f,
|
||||
)
|
||||
assert expected_parameter_list_foo in content
|
||||
|
||||
|
||||
# See: https://github.com/sphinx-doc/sphinx/issues/13217
|
||||
@pytest.mark.sphinx('html', testroot='_blank')
|
||||
def test_js_function_parentheses_in_arguments_and_errors(app: SphinxTestApp) -> None:
|
||||
text = """\
|
||||
.. js:function:: $.getJSON(href)
|
||||
|
||||
:param string href:
|
||||
:throws err:
|
||||
"""
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
refnodes = list(doctree.findall(addnodes.pending_xref))
|
||||
assert len(refnodes) == 2
|
||||
assert_node(refnodes[0], [addnodes.pending_xref, nodes.literal, 'string'])
|
||||
assert_node(refnodes[1], [addnodes.pending_xref, nodes.literal, 'err'])
|
||||
Reference in new issue
Block a user