diff options
author | allixx <1695323+allixx@users.noreply.github.com> | 2023-12-19 11:21:54 +0300 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-01-29 13:15:37 +0100 |
commit | e4cf0a7d4f0416c9b7c45d45db26ccb3eb09af42 (patch) | |
tree | d43b076e913c8cd03d401fb0927cfb82d2ed83ac /tests/unit/test_webutils.py | |
parent | 8c73aa772b7d4446f77be82d8f9d9eef1e348deb (diff) | |
download | searxng-e4cf0a7d4f0416c9b7c45d45db26ccb3eb09af42.tar.gz searxng-e4cf0a7d4f0416c9b7c45d45db26ccb3eb09af42.zip |
[fix] do highlight replacement at once
Highlights all search queries in search result in one go.
Fixes the case where search query contains word from highlight HTML code,
which causes broken HTML to appear in search results.
Closes #3057
Diffstat (limited to 'tests/unit/test_webutils.py')
-rw-r--r-- | tests/unit/test_webutils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/unit/test_webutils.py b/tests/unit/test_webutils.py index 244d2b180..b4395539b 100644 --- a/tests/unit/test_webutils.py +++ b/tests/unit/test_webutils.py @@ -57,6 +57,11 @@ class TestWebUtils(SearxTestCase): ] ), ), + ( + 'a class', + 'a string with class.', + '<span class="highlight">a</span> string with <span class="highlight">class</span>.', + ), ) for query, content, expected in data: self.assertEqual(webutils.highlight_content(content, query), expected) |