@@ -53,11 +53,6 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/infinite-hi
5353 escapeHTML : true ,
5454 } ) ;
5555
56- expect ( widget . getConfiguration ! ( ) ) . toEqual ( {
57- highlightPreTag : TAG_PLACEHOLDER . highlightPreTag ,
58- highlightPostTag : TAG_PLACEHOLDER . highlightPostTag ,
59- } ) ;
60-
6156 expect ( renderFn ) . toHaveBeenCalledTimes ( 0 ) ;
6257
6358 const helper = algoliasearchHelper ( { } as Client , '' , { } ) ;
@@ -121,17 +116,6 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/infinite-hi
121116 ) ;
122117 } ) ;
123118
124- it ( 'sets the default configuration' , ( ) => {
125- const renderFn = ( ) : void => { } ;
126- const makeWidget = connectInfiniteHits ( renderFn ) ;
127- const widget = makeWidget ( { } ) ;
128-
129- expect ( widget . getConfiguration ! ( ) ) . toEqual ( {
130- highlightPreTag : TAG_PLACEHOLDER . highlightPreTag ,
131- highlightPostTag : TAG_PLACEHOLDER . highlightPostTag ,
132- } ) ;
133- } ) ;
134-
135119 it ( 'Provides the hits and accumulates results on next page' , ( ) => {
136120 const renderFn = jest . fn ( ) ;
137121 const makeWidget = connectInfiniteHits ( renderFn ) ;
@@ -624,6 +608,47 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/infinite-hi
624608 expect ( ( results . hits as any ) . __escaped ) . toBe ( true ) ;
625609 } ) ;
626610
611+ describe ( 'getConfiguration' , ( ) => {
612+ it ( 'adds a `page` to the `SearchParameters`' , ( ) => {
613+ const renderFn = ( ) : void => { } ;
614+ const makeWidget = connectInfiniteHits ( renderFn ) ;
615+ const widget = makeWidget ( { } ) ;
616+
617+ const nextConfiguration = widget . getConfiguration ! ( ) ;
618+
619+ expect ( nextConfiguration . page ) . toBe ( 0 ) ;
620+ } ) ;
621+
622+ it ( 'adds the TAG_PLACEHOLDER to the `SearchParameters`' , ( ) => {
623+ const renderFn = ( ) : void => { } ;
624+ const makeWidget = connectInfiniteHits ( renderFn ) ;
625+ const widget = makeWidget ( { } ) ;
626+
627+ const nextConfiguration = widget . getConfiguration ! ( ) ;
628+
629+ expect ( nextConfiguration . highlightPreTag ) . toBe (
630+ TAG_PLACEHOLDER . highlightPreTag
631+ ) ;
632+
633+ expect ( nextConfiguration . highlightPostTag ) . toBe (
634+ TAG_PLACEHOLDER . highlightPostTag
635+ ) ;
636+ } ) ;
637+
638+ it ( 'does not add the TAG_PLACEHOLDER to the `SearchParameters` with `escapeHTML` disabled' , ( ) => {
639+ const renderFn = ( ) : void => { } ;
640+ const makeWidget = connectInfiniteHits ( renderFn ) ;
641+ const widget = makeWidget ( {
642+ escapeHTML : false ,
643+ } ) ;
644+
645+ const nextConfiguration = widget . getConfiguration ! ( ) ;
646+
647+ expect ( nextConfiguration . highlightPreTag ) . toBeUndefined ( ) ;
648+ expect ( nextConfiguration . highlightPostTag ) . toBeUndefined ( ) ;
649+ } ) ;
650+ } ) ;
651+
627652 describe ( 'dispose' , ( ) => {
628653 it ( 'calls the unmount function' , ( ) => {
629654 const helper = algoliasearchHelper ( { } as Client , '' , { } ) ;
@@ -678,7 +703,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/infinite-hi
678703 expect ( nextState . highlightPostTag ) . toBeUndefined ( ) ;
679704 } ) ;
680705
681- it ( 'does not remove the TAG_PLACEHOLDER from the `SearchParameters` with `escapeHTML`' , ( ) => {
706+ it ( 'does not remove the TAG_PLACEHOLDER from the `SearchParameters` with `escapeHTML` disabled ' , ( ) => {
682707 const helper = algoliasearchHelper ( { } as Client , '' , {
683708 highlightPreTag : '<mark>' ,
684709 highlightPostTag : '</mark>' ,
0 commit comments