feat(aio): dont set query params during search #16125 (#16217)

closes #16125

API search still updates query params as sending someone a pre-filtered API search link is  handy.

While typing in the search box no longer updates the URL in the addr bar, you can still create a link like `~/?search=animations` and it will open the search dialog and profile the search box as it may be useful to email such a thing to someone.
This commit is contained in:
Ward Bell 2017-04-21 13:36:37 -07:00 committed by Miško Hevery
parent 9c1318d731
commit 7520ddcf40
2 changed files with 1 additions and 9 deletions

View File

@ -56,12 +56,6 @@ describe('SearchBoxComponent', () => {
input.triggerEventHandler('keyup', { target: { value: 'some query' }, which: 27 }); input.triggerEventHandler('keyup', { target: { value: 'some query' }, which: 27 });
expect(search.search).not.toHaveBeenCalled(); expect(search.search).not.toHaveBeenCalled();
})); }));
it('should set the search part of the browser location', inject([LocationService], (location: MockLocationService) => {
const input = fixture.debugElement.query(By.css('input'));
input.triggerEventHandler('keyup', { target: { value: 'some query' } });
expect(location.setSearch).toHaveBeenCalledWith('Full Text Search', { search: 'some query' });
}));
}); });
describe('on focus', () => { describe('on focus', () => {

View File

@ -41,11 +41,9 @@ export class SearchBoxComponent implements OnInit {
} }
onSearch(query: string, keyCode?: number) { onSearch(query: string, keyCode?: number) {
if (keyCode === 27) { if (keyCode === 27) { // ignore escape key
// Ignore escape key
return; return;
} }
this.locationService.setSearch('Full Text Search', { search: query });
this.searchService.search(query); this.searchService.search(query);
} }
} }