@@ -43,17 +43,6 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/autocomplet
4343 expect ( renderFn . mock . calls [ 1 ] [ 1 ] ) . toBeFalsy ( ) ;
4444 } ) ;
4545
46- it ( 'sets the default configuration' , ( ) => {
47- const renderFn = jest . fn ( ) ;
48- const makeWidget = connectAutocomplete ( renderFn ) ;
49- const widget = makeWidget ( ) ;
50-
51- expect ( widget . getConfiguration ( ) ) . toEqual ( {
52- highlightPreTag : TAG_PLACEHOLDER . highlightPreTag ,
53- highlightPostTag : TAG_PLACEHOLDER . highlightPostTag ,
54- } ) ;
55- } ) ;
56-
5746 it ( 'creates DerivedHelper' , ( ) => {
5847 const renderFn = jest . fn ( ) ;
5948 const makeWidget = connectAutocomplete ( renderFn ) ;
@@ -164,6 +153,47 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/autocomplet
164153 expect ( rendering . indices [ 0 ] . hits ) . toEqual ( hits ) ;
165154 } ) ;
166155
156+ describe ( 'getConfiguration' , ( ) => {
157+ it ( 'adds a `query` to the `SearchParameters`' , ( ) => {
158+ const renderFn = ( ) => { } ;
159+ const makeWidget = connectAutocomplete ( renderFn ) ;
160+ const widget = makeWidget ( ) ;
161+
162+ const nextConfiguation = widget . getConfiguration ( ) ;
163+
164+ expect ( nextConfiguation . query ) . toBe ( '' ) ;
165+ } ) ;
166+
167+ it ( 'adds the TAG_PLACEHOLDER to the `SearchParameters`' , ( ) => {
168+ const renderFn = ( ) => { } ;
169+ const makeWidget = connectAutocomplete ( renderFn ) ;
170+ const widget = makeWidget ( ) ;
171+
172+ const nextConfiguation = widget . getConfiguration ( ) ;
173+
174+ expect ( nextConfiguation . highlightPreTag ) . toBe (
175+ TAG_PLACEHOLDER . highlightPreTag
176+ ) ;
177+
178+ expect ( nextConfiguation . highlightPostTag ) . toBe (
179+ TAG_PLACEHOLDER . highlightPostTag
180+ ) ;
181+ } ) ;
182+
183+ it ( 'does not add the TAG_PLACEHOLDER to the `SearchParameters` with `escapeHTML` disabled' , ( ) => {
184+ const renderFn = ( ) => { } ;
185+ const makeWidget = connectAutocomplete ( renderFn ) ;
186+ const widget = makeWidget ( {
187+ escapeHTML : false ,
188+ } ) ;
189+
190+ const nextConfiguation = widget . getConfiguration ( ) ;
191+
192+ expect ( nextConfiguation . highlightPreTag ) . toBeUndefined ( ) ;
193+ expect ( nextConfiguation . highlightPostTag ) . toBeUndefined ( ) ;
194+ } ) ;
195+ } ) ;
196+
167197 describe ( 'dispose' , ( ) => {
168198 it ( 'calls the unmount function' , ( ) => {
169199 const helper = algoliasearchHelper ( fakeClient , 'firstIndex' ) ;
@@ -291,7 +321,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/autocomplet
291321 expect ( nextState . highlightPostTag ) . toBeUndefined ( ) ;
292322 } ) ;
293323
294- it ( 'does not remove the TAG_PLACEHOLDER from the `SearchParameters` with `escapeHTML`' , ( ) => {
324+ it ( 'does not remove the TAG_PLACEHOLDER from the `SearchParameters` with `escapeHTML` disabled ' , ( ) => {
295325 const helper = algoliasearchHelper ( fakeClient , 'firstIndex' , {
296326 highlightPreTag : '<mark>' ,
297327 highlightPostTag : '</mark>' ,
0 commit comments