@@ -445,6 +445,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
445
445
pages : [ ] ,
446
446
createURL : expect . any ( Function ) ,
447
447
refine : expect . any ( Function ) ,
448
+ canRefine : false ,
448
449
widgetParams : { } ,
449
450
} ) ;
450
451
} ) ;
@@ -461,6 +462,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
461
462
pages : [ ] ,
462
463
createURL : expect . any ( Function ) ,
463
464
refine : expect . any ( Function ) ,
465
+ canRefine : false ,
464
466
widgetParams : { padding : 5 } ,
465
467
} ) ;
466
468
} ) ;
@@ -487,6 +489,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
487
489
pages : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ,
488
490
createURL : expect . any ( Function ) ,
489
491
refine : expect . any ( Function ) ,
492
+ canRefine : true ,
490
493
widgetParams : { padding : 5 } ,
491
494
} ) ;
492
495
} ) ;
@@ -519,6 +522,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
519
522
pages : [ 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 ] ,
520
523
createURL : expect . any ( Function ) ,
521
524
refine : expect . any ( Function ) ,
525
+ canRefine : true ,
522
526
widgetParams : { padding : 5 } ,
523
527
} ) ;
524
528
} ) ;
@@ -551,6 +555,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
551
555
pages : [ 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 ] ,
552
556
createURL : expect . any ( Function ) ,
553
557
refine : expect . any ( Function ) ,
558
+ canRefine : true ,
554
559
widgetParams : { padding : 5 } ,
555
560
} ) ;
556
561
} ) ;
@@ -563,6 +568,34 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
563
568
564
569
expect ( refine2 ) . toBe ( refine1 ) ;
565
570
} ) ;
571
+
572
+ it ( 'gives `canRefine` as false for a single page' , ( ) => {
573
+ const [ widget ] = getInitializedWidget ( ) ;
574
+
575
+ const { canRefine } = widget . getWidgetRenderState (
576
+ createRenderOptions ( {
577
+ results : new SearchResults ( new SearchParameters ( ) , [
578
+ createSingleSearchResponse ( { nbPages : 1 } ) ,
579
+ ] ) ,
580
+ } )
581
+ ) ;
582
+
583
+ expect ( canRefine ) . toBe ( false ) ;
584
+ } ) ;
585
+
586
+ it ( 'gives `canRefine` as true for a multiple pages' , ( ) => {
587
+ const [ widget ] = getInitializedWidget ( ) ;
588
+
589
+ const { canRefine } = widget . getWidgetRenderState (
590
+ createRenderOptions ( {
591
+ results : new SearchResults ( new SearchParameters ( ) , [
592
+ createSingleSearchResponse ( { nbPages : 2 } ) ,
593
+ ] ) ,
594
+ } )
595
+ ) ;
596
+
597
+ expect ( canRefine ) . toBe ( true ) ;
598
+ } ) ;
566
599
} ) ;
567
600
568
601
describe ( 'getRenderState' , ( ) => {
@@ -601,6 +634,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/pagination/
601
634
pages : [ 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 ] ,
602
635
createURL : expect . any ( Function ) ,
603
636
refine : expect . any ( Function ) ,
637
+ canRefine : true ,
604
638
widgetParams : { padding : 5 } ,
605
639
} ,
606
640
} ) ;
0 commit comments