Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
fix(createAutocompleteSource): missing hitsPerPage forward (#313)
Browse files Browse the repository at this point in the history
Fix #308
  • Loading branch information
redox authored Aug 19, 2016
1 parent c8abbfc commit 74e4520
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/createAutocompleteSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function createAutocompleteSource({
clientOptions,
apiKey,
appId,
hitsPerPage,
aroundLatLng,
aroundRadius,
aroundLatLngViaIP,
Expand All @@ -28,7 +29,7 @@ export default function createAutocompleteSource({

const defaultQueryParams = {
countries,
hitsPerPage: 5,
hitsPerPage: hitsPerPage || 5,
language,
type
};
Expand Down
6 changes: 6 additions & 0 deletions src/createAutocompleteSource.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ describe('createAutocompleteSource', () => {
expect(algoliasearch.__searchSpy).toBeCalledWith({...defaults, aroundRadius: 2000});
});

it('supports hitsPerPage option', () => {
const {source, defaults} = setup({hitsPerPage: 2});
source(defaults.query);
expect(algoliasearch.__searchSpy).toBeCalledWith({...defaults, hitsPerPage: 2});
});

it('supports useDeviceLocation option', () => {
const latitude = '456';
const longitude = '789';
Expand Down

0 comments on commit 74e4520

Please sign in to comment.