mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 11:11:59 +08:00
FIX: word boundary regex (\b) not working in Unicode languages. (#9163)
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
import highlightText, { CLASS_NAME } from "discourse/lib/highlight-text";
|
||||
import { fixture } from "helpers/qunit-helpers";
|
||||
|
||||
QUnit.module("lib:highlight-text");
|
||||
|
||||
QUnit.test("highlighting text", assert => {
|
||||
fixture().html(
|
||||
`
|
||||
<p>This is some text to highlight</p>
|
||||
`
|
||||
);
|
||||
|
||||
highlightText(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"
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user