fix(aio): `SearchBoxComponent` should send query on click

The input may still have focus when the user hits ESC,
causing the search to be hidden.

If the user then clicks on the input again, they would expect
it to reopen the results.
This commit is contained in:
Peter Bacon Darwin 2017-03-12 15:05:01 +00:00 committed by Chuck Jazdzewski
parent 0e6eb6d719
commit c95a3048ce
2 changed files with 10 additions and 1 deletions

View File

@ -3,5 +3,6 @@
mdInput
placeholder="Search"
(keyup)="onSearch($event.target.value, $event.which)"
(focus)="onSearch($event.target.value)">
(focus)="onSearch($event.target.value)"
(click)="onSearch($event.target.value)">
</md-input-container>

View File

@ -67,4 +67,12 @@ describe('SearchBoxComponent', () => {
expect(search.search).toHaveBeenCalledWith('some query');
}));
});
describe('on click', () => {
it('should call the search service on click', inject([SearchService], (search: SearchService) => {
const input = fixture.debugElement.query(By.css('input'));
input.triggerEventHandler('click', { target: { value: 'some query'}});
expect(search.search).toHaveBeenCalledWith('some query');
}));
});
});