feat(aio): improve search results functionality

* Ensure that all indexed documents are displayed in the search results.
(Previously the guide documents were not appearing because we only showed
results that had a `name` property, rather than a `name` or `title`.)
* Group the results by their containing folder (e.g. api, guide, tutorial, etc).
* Hide the results when the user hits the ESC key.
* Hide the results when the user clicks on a search result

Closes #14852
This commit is contained in:
Peter Bacon Darwin
2017-03-13 19:58:31 +00:00
committed by Chuck Jazdzewski
parent 8850098ea4
commit 6497633529
17 changed files with 356 additions and 37 deletions

View File

@ -3,6 +3,8 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject';
export class MockLocationService {
urlSubject = new BehaviorSubject<string>(this.initialUrl);
currentUrl = this.urlSubject.asObservable();
search = jasmine.createSpy('search').and.returnValue({});
setSearch = jasmine.createSpy('setSearch');
constructor(private initialUrl) {}
}

View File

@ -0,0 +1,10 @@
import { Subject } from 'rxjs/Subject';
import { SearchResults } from 'app/search/search.service';
export class MockSearchService {
searchResults = new Subject<SearchResults>();
initWorker = jasmine.createSpy('initWorker');
loadIndex = jasmine.createSpy('loadIndex');
search = jasmine.createSpy('search');
hideResults = jasmine.createSpy('hideResults');
}