mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 05:41:15 +08:00
Revert "FIX: word boundary regex (\b) not working in Unicode languages. (#9163)"
Lookbehind regex is not supported in Firefox or IE11 This reverts commit 572bb5988f4a46bc5f66f7e9d4a09b7241c532fb.
This commit is contained in:
@ -1,48 +0,0 @@
|
||||
import highlightSearch, { CLASS_NAME } from "discourse/lib/highlight-search";
|
||||
import { fixture } from "helpers/qunit-helpers";
|
||||
|
||||
QUnit.module("lib:highlight-search");
|
||||
|
||||
QUnit.test("highlighting text", assert => {
|
||||
fixture().html(
|
||||
`
|
||||
<p>This is some text to highlight</p>
|
||||
`
|
||||
);
|
||||
|
||||
highlightSearch(fixture(), "some text");
|
||||
|
||||
const terms = [];
|
||||
|
||||
fixture(`.${CLASS_NAME}`).each((_, elem) => {
|
||||
terms.push(elem.textContent);
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
terms.join(" "),
|
||||
"some text",
|
||||
"it should highlight the terms correctly"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("highlighting unicode text", assert => {
|
||||
fixture().html(
|
||||
`
|
||||
<p>This is some தமிழ் and русский text to highlight</p>
|
||||
`
|
||||
);
|
||||
|
||||
highlightSearch(fixture(), "தமிழ் русский");
|
||||
|
||||
const terms = [];
|
||||
|
||||
fixture(`.${CLASS_NAME}`).each((_, elem) => {
|
||||
terms.push(elem.textContent);
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
terms.join(" "),
|
||||
"தமிழ் русский",
|
||||
"it should highlight the terms correctly"
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user