mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
commit a2ebb2192ac73211a8924111d736df9574abf61b
Author: 沈唁 <52o@qq52o.cn>
Date: Sun Nov 8 16:48:43 2020 +0800
fix: search titles containing ignored characters (#1395)
* fix: search titles containing ignored characters
* fix
* add default value
* add test
* fix test
Co-authored-by: Koy <koy@ko8e24.top>
commit 58fbca00ebd12f636c213d386761df9ebfb2bd4c
Author: Snyk bot <snyk-bot@snyk.io>
Date: Thu Nov 5 03:04:19 2020 +0200
fix: packages/docsify-server-renderer/package.json & packages/docsify-server-renderer/package-lock.json to reduce vulnerabilities (#1418)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-DOMPURIFY-1035544
77 lines
2.1 KiB
JavaScript
77 lines
2.1 KiB
JavaScript
const docsifyInit = require('../helpers/docsify-init');
|
|
|
|
// Suite
|
|
// -----------------------------------------------------------------------------
|
|
describe('Search Plugin Tests', function() {
|
|
// Tests
|
|
// ---------------------------------------------------------------------------
|
|
test('search readme', async () => {
|
|
const docsifyInitConfig = {
|
|
markdown: {
|
|
homepage: `
|
|
# Hello World
|
|
|
|
This is the homepage.
|
|
`,
|
|
sidebar: `
|
|
- [Home page](/)
|
|
- [Test Page](test)
|
|
`,
|
|
},
|
|
routes: {
|
|
'/test.md': `
|
|
# Test Page
|
|
|
|
This is a custom route.
|
|
`,
|
|
},
|
|
scriptURLs: ['/lib/plugins/search.min.js'],
|
|
};
|
|
|
|
await docsifyInit(docsifyInitConfig);
|
|
await page.fill('input[type=search]', 'hello');
|
|
await expect(page).toEqualText('.results-panel h2', 'Hello World');
|
|
await page.click('.clear-button');
|
|
await page.fill('input[type=search]', 'test');
|
|
await expect(page).toEqualText('.results-panel h2', 'Test Page');
|
|
});
|
|
|
|
test('search ignore title', async () => {
|
|
const docsifyInitConfig = {
|
|
markdown: {
|
|
homepage: `
|
|
# Hello World
|
|
|
|
This is the homepage.
|
|
`,
|
|
sidebar: `
|
|
- [Home page](/)
|
|
- [GitHub Pages](github)
|
|
`,
|
|
},
|
|
routes: {
|
|
'/github.md': `
|
|
# GitHub Pages
|
|
|
|
This is the GitHub Pages.
|
|
|
|
## GitHub Pages ignore1 <!-- {docsify-ignore} -->
|
|
|
|
There're three places to populate your docs for your Github repository1.
|
|
|
|
## GitHub Pages ignore2 {docsify-ignore}
|
|
|
|
There're three places to populate your docs for your Github repository2.
|
|
`,
|
|
},
|
|
scriptURLs: ['/lib/plugins/search.min.js'],
|
|
};
|
|
await docsifyInit(docsifyInitConfig);
|
|
await page.fill('input[type=search]', 'repository1');
|
|
await expect(page).toEqualText('.results-panel h2', 'GitHub Pages ignore1');
|
|
await page.click('.clear-button');
|
|
await page.fill('input[type=search]', 'repository2');
|
|
await expect(page).toEqualText('.results-panel h2', 'GitHub Pages ignore2');
|
|
});
|
|
});
|