@@ -1599,6 +1599,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/range-input
1599
1599
max : 0 ,
1600
1600
min : 0 ,
1601
1601
} ,
1602
+ canRefine : false ,
1602
1603
refine : expect . any ( Function ) ,
1603
1604
sendEvent : expect . any ( Function ) ,
1604
1605
start : [ 0 , 1000 ] ,
@@ -1633,6 +1634,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/range-input
1633
1634
min : 10 ,
1634
1635
max : 30 ,
1635
1636
} ,
1637
+ canRefine : true ,
1636
1638
refine : expect . any ( Function ) ,
1637
1639
sendEvent : expect . any ( Function ) ,
1638
1640
start : [ 0 , 1000 ] ,
@@ -1676,6 +1678,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/range-input
1676
1678
max : 0 ,
1677
1679
min : 0 ,
1678
1680
} ,
1681
+ canRefine : false ,
1679
1682
refine : expect . any ( Function ) ,
1680
1683
sendEvent : expect . any ( Function ) ,
1681
1684
start : [ 0 , 1000 ] ,
@@ -1707,6 +1710,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/range-input
1707
1710
max : 30 ,
1708
1711
min : 10 ,
1709
1712
} ,
1713
+ canRefine : true ,
1710
1714
refine : expect . any ( Function ) ,
1711
1715
sendEvent : expect . any ( Function ) ,
1712
1716
start : [ 0 , 1000 ] ,
@@ -1716,6 +1720,50 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/range-input
1716
1720
} ,
1717
1721
} ) ;
1718
1722
} ) ;
1723
+
1724
+ it ( 'canRefine returns false when the result range is empty' , ( ) => {
1725
+ const renderFn = jest . fn ( ) ;
1726
+ const unmountFn = jest . fn ( ) ;
1727
+ const createRange = connectRange ( renderFn , unmountFn ) ;
1728
+ const rangeWidget = createRange ( {
1729
+ attribute : 'price' ,
1730
+ } ) ;
1731
+ const helper = jsHelper ( createSearchClient ( ) , 'indexName' , {
1732
+ disjunctiveFacets : [ 'price' ] ,
1733
+ } ) ;
1734
+
1735
+ const renderState = rangeWidget . getWidgetRenderState (
1736
+ createRenderOptions ( {
1737
+ helper,
1738
+ state : helper . state ,
1739
+ results : createFacetStatsResults ( {
1740
+ min : 1000 ,
1741
+ max : 1000 ,
1742
+ helper,
1743
+ attribute : 'price' ,
1744
+ } ) ,
1745
+ } )
1746
+ ) ;
1747
+
1748
+ expect ( renderState ) . toEqual ( {
1749
+ format : {
1750
+ from : expect . any ( Function ) ,
1751
+ to : expect . any ( Function ) ,
1752
+ } ,
1753
+ range : {
1754
+ max : 1000 ,
1755
+ min : 1000 ,
1756
+ } ,
1757
+ canRefine : false ,
1758
+ refine : expect . any ( Function ) ,
1759
+ sendEvent : expect . any ( Function ) ,
1760
+ start : [ - Infinity , Infinity ] ,
1761
+ widgetParams : {
1762
+ attribute : 'price' ,
1763
+ precision : 0 ,
1764
+ } ,
1765
+ } ) ;
1766
+ } ) ;
1719
1767
} ) ;
1720
1768
1721
1769
describe ( 'getWidgetSearchParameters' , ( ) => {
0 commit comments