Skip to content

Commit

Permalink
Revert "fix: fix search with no content. (#1878)"
Browse files Browse the repository at this point in the history
This reverts commit 930ad95.
  • Loading branch information
Koooooo-7 authored Oct 26, 2022
1 parent 0911128 commit 575f8ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
15 changes: 7 additions & 8 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,14 @@ export function search(query) {
}

const matchContent =
handlePostContent &&
'...' +
handlePostContent
.substring(start, end)
.replace(
regEx,
word => `<em class="search-keyword">${word}</em>`
) +
'...';
handlePostContent
.substring(start, end)
.replace(
regEx,
word => `<em class="search-keyword">${word}</em>`
) +
'...';

resultStr += matchContent;
}
Expand Down
20 changes: 0 additions & 20 deletions test/e2e/search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,4 @@ test.describe('Search Plugin Tests', () => {
await searchFieldElm.fill('hello');
await expect(resultsHeadingElm).toHaveText('Changelog Title');
});
test('search when there is no body', async ({ page }) => {
const docsifyInitConfig = {
markdown: {
homepage: `
# EmptyContent
---
---
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
};

const searchFieldElm = page.locator('input[type=search]');
const resultsHeadingElm = page.locator('.results-panel h2');

await docsifyInit(docsifyInitConfig);

await searchFieldElm.fill('empty');
await expect(resultsHeadingElm).toHaveText('EmptyContent');
});
});

0 comments on commit 575f8ec

Please sign in to comment.