From 7520ddcf4084bdbc9556ad7d4a226903a1865dc6 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Fri, 21 Apr 2017 13:36:37 -0700 Subject: [PATCH] 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. --- aio/src/app/search/search-box/search-box.component.spec.ts | 6 ------ aio/src/app/search/search-box/search-box.component.ts | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/aio/src/app/search/search-box/search-box.component.spec.ts b/aio/src/app/search/search-box/search-box.component.spec.ts index 1f58b0c05c..1d7c27a2a9 100644 --- a/aio/src/app/search/search-box/search-box.component.spec.ts +++ b/aio/src/app/search/search-box/search-box.component.spec.ts @@ -56,12 +56,6 @@ describe('SearchBoxComponent', () => { input.triggerEventHandler('keyup', { target: { value: 'some query' }, which: 27 }); 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', () => { diff --git a/aio/src/app/search/search-box/search-box.component.ts b/aio/src/app/search/search-box/search-box.component.ts index 87f2c0a35e..1be305f6d5 100644 --- a/aio/src/app/search/search-box/search-box.component.ts +++ b/aio/src/app/search/search-box/search-box.component.ts @@ -41,11 +41,9 @@ export class SearchBoxComponent implements OnInit { } onSearch(query: string, keyCode?: number) { - if (keyCode === 27) { - // Ignore escape key + if (keyCode === 27) { // ignore escape key return; } - this.locationService.setSearch('Full Text Search', { search: query }); this.searchService.search(query); } }