Skip to content

Commit

Permalink
fix: Can't search homepage content (#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 Oct 14, 2020
1 parent ae45b32 commit 25bc9b7
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');
});
});

1 comment on commit 25bc9b7

@vercel
Copy link

@vercel vercel bot commented on 25bc9b7 Oct 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.