File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
2525 foo : 'bar' ,
2626 } ) ;
2727
28- expect ( widget . getConfiguration ) . toBe ( undefined ) ;
29-
3028 const helper = algoliasearchHelper ( { } ) ;
3129 helper . search = jest . fn ( ) ;
3230
@@ -254,6 +252,18 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
254252 }
255253 } ) ;
256254
255+ describe ( 'getConfiguration' , ( ) => {
256+ it ( 'adds a `page` to the `SearchParameters`' , ( ) => {
257+ const renderFn = ( ) => { } ;
258+ const makeWidget = connectPagination ( renderFn ) ;
259+ const widget = makeWidget ( ) ;
260+
261+ const nextConfiguation = widget . getConfiguration ( ) ;
262+
263+ expect ( nextConfiguation . page ) . toBe ( 0 ) ;
264+ } ) ;
265+ } ) ;
266+
257267 describe ( 'dispose' , ( ) => {
258268 it ( 'calls the unmount function' , ( ) => {
259269 const helper = algoliasearchHelper ( { } , '' ) ;
Original file line number Diff line number Diff line change @@ -98,6 +98,12 @@ export default function connectPagination(renderFn, unmountFn = noop) {
9898 } ) ;
9999
100100 return {
101+ getConfiguration ( ) {
102+ return {
103+ page : 0 ,
104+ } ;
105+ } ,
106+
101107 init ( { helper, createURL, instantSearchInstance } ) {
102108 this . refine = page => {
103109 helper . setPage ( page ) ;
Original file line number Diff line number Diff line change @@ -72,10 +72,6 @@ describe('pagination()', () => {
7272 widget . init ( { helper } ) ;
7373 } ) ;
7474
75- it ( 'configures nothing' , ( ) => {
76- expect ( widget . getConfiguration ) . toEqual ( undefined ) ;
77- } ) ;
78-
7975 it ( 'sets the page' , ( ) => {
8076 widget . refine ( helper , 42 ) ;
8177 expect ( helper . setPage ) . toHaveBeenCalledTimes ( 1 ) ;
You can’t perform that action at this time.
0 commit comments