File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
src/connectors/voice-search Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,29 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/voice-searc
141141
142142 const nextConfiguration = widget . getConfiguration ( new SearchParameters ( ) ) ;
143143
144- expect ( nextConfiguration . query ) . toBe ( '' ) ;
144+ expect ( nextConfiguration ) . toEqual (
145+ new SearchParameters ( {
146+ query : '' ,
147+ } )
148+ ) ;
149+ } ) ;
150+
151+ it ( 'support previous `query` from the `SearchParameters`' , ( ) => {
152+ const renderFn = ( ) => { } ;
153+ const makeWidget = connectVoiceSearch ( renderFn ) ;
154+ const widget = makeWidget ( { } ) ;
155+
156+ const nextConfiguration = widget . getConfiguration (
157+ new SearchParameters ( {
158+ query : 'Previous query' ,
159+ } )
160+ ) ;
161+
162+ expect ( nextConfiguration ) . toEqual (
163+ new SearchParameters ( {
164+ query : 'Previous query' ,
165+ } )
166+ ) ;
145167 } ) ;
146168 } ) ;
147169
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ const connectVoiceSearch: VoiceSearchConnector = (
7777 $$type : 'ais.voiceSearch' ,
7878
7979 getConfiguration ( config ) {
80- return config . setQuery ( '' ) ;
80+ return config . setQuery ( config . query || '' ) ;
8181 } ,
8282
8383 init ( { helper, instantSearchInstance } ) {
You can’t perform that action at this time.
0 commit comments