Skip to content

Commit 09cf221

Browse files
committed
update: fix mismatch search content
1 parent ca5859a commit 09cf221

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/plugins/search/search.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ export function search(query) {
230230
start = indexContent < 11 ? 0 : indexContent - 10;
231231
end = start === 0 ? 100 : indexContent + keyword.length + 90;
232232

233-
if (postContent && end > postContent.length) {
234-
end = postContent.length;
233+
if (handlePostContent && end > handlePostContent.length) {
234+
end = handlePostContent.length;
235235
}
236236

237237
const matchContent =

test/e2e/search.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ console.log('Hello World');
254254
await searchFieldElm.fill('searchHere');
255255
// there is a newline after searchHere and the markdown part ```js ``` it should be removed
256256
expect(await resultsHeadingElm.textContent()).toContain(
257-
"...searchHere\nconsole.log('Hello Worl...",
257+
"...searchHere\nconsole.log('Hello World');...",
258258
);
259259
});
260260

0 commit comments

Comments
 (0)