@@ -211,6 +211,55 @@ describe('Testing Component: Filters', () => {
211211 expect ( maxInputSlider . value ) . toBe ( mockPriceFacet . status . max . toString ( ) ) ;
212212 } ) ;
213213 } ) ;
214+
215+ it . only ( 'Edge Case: If facet.status.min = 0, should render ranged filters that have already been applied correctly' , async ( ) => {
216+ const mockPriceFacet = {
217+ displayName : 'Price' ,
218+ name : 'price' ,
219+ type : 'range' ,
220+ data : { } ,
221+ hidden : false ,
222+ min : 0 ,
223+ max : 100 ,
224+ status : {
225+ min : 0 ,
226+ max : 75 ,
227+ } ,
228+ } ;
229+
230+ const { getByText, container } = render (
231+ < CioPlp apiKey = { DEMO_API_KEY } >
232+ < Filters facets = { [ mockPriceFacet ] } />
233+ </ CioPlp > ,
234+ ) ;
235+
236+ await waitFor ( ( ) => {
237+ expect ( getByText ( mockPriceFacet . displayName ) . toBeInTheDocument ) ;
238+
239+ const minInputValue = container . querySelector ( '.cio-slider-input-min input' ) ;
240+ const maxInputValue = container . querySelector ( '.cio-slider-input-max input' ) ;
241+
242+ expect ( minInputValue . value ) . toBe ( mockPriceFacet . status . min . toString ( ) ) ;
243+ expect ( maxInputValue . value ) . toBe ( mockPriceFacet . status . max . toString ( ) ) ;
244+
245+ const selectableTrack = container . querySelector (
246+ '.cio-doubly-ended-slider .cio-slider-track-selected' ,
247+ ) ;
248+ const minInputSlider = container . querySelector ( '.cio-doubly-ended-slider .cio-min-slider' ) ;
249+ const maxInputSlider = container . querySelector ( '.cio-doubly-ended-slider .cio-max-slider' ) ;
250+
251+ expect ( selectableTrack . style . width ) . toBe ( '75.00%' ) ;
252+ expect ( selectableTrack . style . left ) . toBe ( '0.00%' ) ;
253+
254+ expect ( minInputSlider . min ) . toBe ( mockPriceFacet . min . toString ( ) ) ;
255+ expect ( minInputSlider . max ) . toBe ( mockPriceFacet . max . toString ( ) ) ;
256+ expect ( minInputSlider . value ) . toBe ( mockPriceFacet . status . min . toString ( ) ) ;
257+
258+ expect ( maxInputSlider . min ) . toBe ( mockPriceFacet . min . toString ( ) ) ;
259+ expect ( maxInputSlider . max ) . toBe ( mockPriceFacet . max . toString ( ) ) ;
260+ expect ( maxInputSlider . value ) . toBe ( mockPriceFacet . status . max . toString ( ) ) ;
261+ } ) ;
262+ } ) ;
214263 } ) ;
215264
216265 describe ( ' - Behavior Tests' , ( ) => {
0 commit comments