mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
Automatically generated by `eslint --fix` to satisfy the updated configuration
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import { setupTest } from "ember-qunit";
|
|
import { module, test } from "qunit";
|
|
import highlightSearch, { CLASS_NAME } from "discourse/lib/highlight-search";
|
|
import { fixture } from "discourse/tests/helpers/qunit-helpers";
|
|
|
|
module("Unit | Utility | highlight-search", function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test("highlighting text", function (assert) {
|
|
fixture().innerHTML = `
|
|
<p>This is some text to highlight</p>
|
|
`;
|
|
|
|
highlightSearch(fixture(), "some text");
|
|
|
|
const terms = [fixture(`.${CLASS_NAME}`).textContent];
|
|
|
|
assert.strictEqual(
|
|
terms.join(" "),
|
|
"some text",
|
|
"it should highlight the terms correctly"
|
|
);
|
|
});
|
|
|
|
test("highlighting unicode text", function (assert) {
|
|
fixture().innerHTML = `
|
|
<p>This is some தமிழ் & русский text to highlight</p>
|
|
`;
|
|
|
|
highlightSearch(fixture(), "தமிழ் & русский");
|
|
|
|
const terms = [fixture(`.${CLASS_NAME}`).textContent];
|
|
|
|
assert.strictEqual(
|
|
terms.join(" "),
|
|
"தமிழ் & русский",
|
|
"it should highlight the terms correctly"
|
|
);
|
|
});
|
|
});
|