Skip to content

Commit fb70363

Browse files
samoussHaroenv
authored andcommitted
feat(connectVoiceSearch): add default value on getConfiguration (#3841)
1 parent aa4602c commit fb70363

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/connectors/voice-search/__tests__/connectVoiceSearch-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/voice-searc
113113
expect(helper.search).toHaveBeenCalledTimes(1);
114114
});
115115

116+
describe('getConfiguration', () => {
117+
it('adds a `query` to the `SearchParameters`', () => {
118+
const renderFn = () => {};
119+
const makeWidget = connectVoiceSearch(renderFn);
120+
const widget = makeWidget({});
121+
122+
const nextConfiguration = widget.getConfiguration();
123+
124+
expect(nextConfiguration.query).toBe('');
125+
});
126+
});
127+
116128
describe('dispose', () => {
117129
it('calls the unmount function', () => {
118130
const helper = algoliasearchHelper({}, '');

src/connectors/voice-search/connectVoiceSearch.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ const connectVoiceSearch: VoiceSearchConnector = (
7474
const { searchAsYouSpeak = false } = widgetParams;
7575

7676
return {
77+
getConfiguration() {
78+
return {
79+
query: '',
80+
};
81+
},
82+
7783
init({ helper, instantSearchInstance }) {
7884
(this as any)._refine = (query: string): void => {
7985
if (query !== helper.state.query) {

0 commit comments

Comments
 (0)