FIX: Letters between words incorrectly highlighted within post.

This commit is contained in:
Guo Xiang Tan
2019-04-03 15:57:51 +08:00
parent e8a4d72281
commit d1fa2b71cf
4 changed files with 18 additions and 8 deletions

View File

@@ -75,15 +75,22 @@ QUnit.test("Search with context", async assert => {
await visit("/t/internationalization-localization/280/1");
await click("#search-button");
await fillIn("#search-term", "dev");
await fillIn("#search-term", "a proper");
await click(".search-context input[type='checkbox']");
await keyEvent("#search-term", "keyup", 16);
assert.ok(exists(".search-menu .results ul li"), "it shows results");
assert.ok(
exists(".cooked span.highlight-strong"),
"it should highlight the search term"
const highlighted = [];
find("#post_7 span.highlight-strong").map((_, span) => {
highlighted.push(span.innerText);
});
assert.deepEqual(
highlighted,
["a", "a", "proper", "a"],
"it should highlight the post with the search terms correctly"
);
let callbackCalled = false;