|
| 1 | +const docsifyInit = require('../helpers/docsify-init'); |
| 2 | + |
| 3 | +// Suite |
| 4 | +// ----------------------------------------------------------------------------- |
| 5 | +describe('Search Plugin Tests', function() { |
| 6 | + // Tests |
| 7 | + // --------------------------------------------------------------------------- |
| 8 | + test('search readme', async () => { |
| 9 | + const docsifyInitConfig = { |
| 10 | + markdown: { |
| 11 | + homepage: ` |
| 12 | + # Hello World |
| 13 | + |
| 14 | + This is the homepage. |
| 15 | + `, |
| 16 | + sidebar: ` |
| 17 | + - [Home page](/) |
| 18 | + - [Test Page](test) |
| 19 | + `, |
| 20 | + }, |
| 21 | + routes: { |
| 22 | + '/test.md': ` |
| 23 | + # Test Page |
| 24 | + |
| 25 | + This is a custom route. |
| 26 | + `, |
| 27 | + }, |
| 28 | + scriptURLs: ['/lib/plugins/search.min.js'], |
| 29 | + }; |
| 30 | + |
| 31 | + await docsifyInit(docsifyInitConfig); |
| 32 | + await page.fill('input[type=search]', 'hello'); |
| 33 | + await expect(page).toEqualText('.results-panel h2', 'Hello World'); |
| 34 | + await page.click('.clear-button'); |
| 35 | + await page.fill('input[type=search]', 'test'); |
| 36 | + await expect(page).toEqualText('.results-panel h2', 'Test Page'); |
| 37 | + }); |
| 38 | +}); |
0 commit comments