mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
add tests for meta-tag search index generation #2463
This commit is contained in:
parent
b01a7be5c6
commit
a8dabf334d
11
tests/roots/test-search/conf.py
Normal file
11
tests/roots/test-search/conf.py
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
|
||||
master_doc = 'index'
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
html_search_language = 'en'
|
8
tests/roots/test-search/index.rst
Normal file
8
tests/roots/test-search/index.rst
Normal file
@ -0,0 +1,8 @@
|
||||
meta keywords
|
||||
=============
|
||||
|
||||
.. meta::
|
||||
:keywords lang=en: findthiskey
|
||||
:keywords lang=de: findnotthiskey
|
||||
:keywords: thisonetoo
|
||||
|
@ -52,3 +52,11 @@ def test_objects_are_escaped(app, status, warning):
|
||||
|
||||
index = jsdump.loads(searchindex[16:-2])
|
||||
assert 'n::Array<T, d>' in index.get('objects').get('') # n::Array<T,d> is escaped
|
||||
|
||||
@with_app(testroot='search')
|
||||
def test_meta_keys_are_handled_for_language(app, status, warning):
|
||||
app.builder.build_all()
|
||||
searchindex = (app.outdir / 'searchindex.js').text()
|
||||
assert 'findnotthiskey' not in searchindex
|
||||
assert 'findthiskei' in searchindex
|
||||
assert 'thisonetoo' in searchindex
|
Loading…
Reference in New Issue
Block a user