Closes #8123: Fix plus-handling (+) in search terms for basic html theme search

Note, that the default splitter will not index +, so this isn't of much of much use, unless
the splitter of the search-language is reconfigured.
This commit is contained in:
Daniel Hofmann
2020-08-19 16:41:20 +02:00
parent fabe685638
commit 3e479d772b
6 changed files with 56 additions and 3 deletions

View File

@@ -12,6 +12,10 @@ describe('jQuery extensions', function() {
expect(jQuery.urldecode(test_encoded_string)).toEqual(test_decoded_string);
});
it('+ should result in " "', function() {
expect(jQuery.urldecode('+')).toEqual(' ');
});
});
describe('getQueryParameters', function() {

32
tests/js/searchtools.js Normal file
View File

@@ -0,0 +1,32 @@
describe('Basic html theme search', function() {
describe('terms search', function() {
it('should find "C++" when in index', function() {
index = {
docnames:["index"],
filenames:["index.rst"],
terms:{'c++':0},
titles:["<no title>"],
titleterms:{}
}
Search.setIndex(index);
searchterms = ['c++'];
excluded = [];
terms = index.terms;
titleterms = index.titleterms;
hits = [[
"index",
"<no title>",
"",
null,
2,
"index.rst"
]];
expect(Search.performTermsSearch(searchterms, excluded, terms, titleterms)).toEqual(hits);
});
});
});