diff --git a/src/lib/DocSearch.js b/src/lib/DocSearch.js index 22d7f3f2..ad3521f7 100644 --- a/src/lib/DocSearch.js +++ b/src/lib/DocSearch.js @@ -60,7 +60,10 @@ class DocSearch { footer: templates.footer } }]); - this.autocomplete.on('autocomplete:selected', this.handleSelected.bind(null, this.autocomplete.autocomplete)); + this.autocomplete.on( + 'autocomplete:selected', + this.handleSelected.bind(null, this.autocomplete.autocomplete) + ); } /** diff --git a/src/lib/templates.js b/src/lib/templates.js index 4358ae36..c9f7fb1a 100644 --- a/src/lib/templates.js +++ b/src/lib/templates.js @@ -10,7 +10,9 @@ let templates = { ">
{{{category}}}
-
{{{subcategory}}}
+
+ {{{subcategory}}} +
{{{subcategory}}}
{{{title}}}
diff --git a/test/DocSearch-test.js b/test/DocSearch-test.js index 196b17d9..d0390c63 100644 --- a/test/DocSearch-test.js +++ b/test/DocSearch-test.js @@ -685,7 +685,11 @@ describe('DocSearch', () => { let actual = DocSearch.formatHits(input); // Then - expect(actual[0].title).toEqual('Geo-searchFooBarBaz'); + let expected = 'Geo-search' + + ' › Foo' + + ' › Bar' + + ' › Baz'; + expect(actual[0].title).toEqual(expected); }); it('should add ellipsis to content', () => { // Given diff --git a/test/helpers.js b/test/helpers.js index 8a9d16cb..ad454d9c 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -5,7 +5,15 @@ global.iit = it.only; global.xit = it.skip; /** - * Wait for max `escapeTime` ms and run `runFunction` except if `escapeFunction` returned true + * Runs `runFunction` only when `escapeFunction` returns true. Timeout after + * `escapeTime`ms. + * @function waitForAndRun + * @param {function} escapeFunction Function to wait for. Once it returns + * `true`, we execute `runFunction` + * @param {function} runFunction Function to run once `escapeFunction` returns + * `true. + * @param {number} escapeTime Time (in ms) after which we timeout. + * @returns {void} */ function waitForAndRun(escapeFunction, runFunction, escapeTime) { // check the escapeFunction every millisecond so as soon as it is met we can escape the function