Skip to content

Commit

Permalink
fix: Can't search homepage content (docsifyjs#1391)
Browse files Browse the repository at this point in the history
* fix: Can't search homepage content

* fix: when pathNamespaces does not exist

* add test

* update test to fix windows ci
  • Loading branch information
sy-records authored and Koooooo-7 committed Oct 15, 2020
1 parent 0a79581 commit 9bfac00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ export function init(config, vm) {
namespaceSuffix = matches[0];
}
}
paths.unshift(namespaceSuffix + '/');
} else {
paths.unshift('/');
}

const expireKey = resolveExpireKey(config.namespace) + namespaceSuffix;
Expand Down
16 changes: 16 additions & 0 deletions test/e2e/sidebar.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const docsifyInit = require('../helpers/docsify-init');

// Suite
// -----------------------------------------------------------------------------
describe('Sidebar Tests', function() {
// Tests
// ---------------------------------------------------------------------------
test('search readme', async () => {
await docsifyInit();
await page.goto(DOCS_URL + '/#/quickstart');
await page.fill('input[type=search]', 'Please consider donating');
expect(
await page.innerText('.results-panel > .matching-post > a > h2')
).toEqual('Donate');
});
});

0 comments on commit 9bfac00

Please sign in to comment.