@@ -214,6 +214,56 @@ def test_should_work_with_plain_hashes_for_responsive_image_attributes
214214 assert_equal ( expected , result . to_h )
215215 end
216216
217+ # Test to verify that srcset uses integer descriptors (640w) not float (640.0w)
218+ # This tests both model object and hash approaches
219+ def test_should_use_integer_descriptors_in_srcset_with_model_object
220+ # Using GetImageAttributesOptions model with Float array (as defined in schema)
221+ result = @client . helper . get_responsive_image_attributes (
222+ Imagekit ::Models ::GetImageAttributesOptions . new (
223+ src : "sample.jpg" ,
224+ url_endpoint : "https://ik.imagekit.io/demo" ,
225+ device_breakpoints : [ 320.0 , 640.0 , 1280.0 ] , # SDK converts to floats
226+ image_breakpoints : [ ]
227+ )
228+ )
229+
230+ src_set = result . src_set
231+
232+ # Should have integer descriptors like "320w", NOT "320.0w"
233+ assert_includes ( src_set , "320w" )
234+ assert_includes ( src_set , "640w" )
235+ assert_includes ( src_set , "1280w" )
236+
237+ # Should NOT have float descriptors
238+ refute_includes ( src_set , "320.0w" )
239+ refute_includes ( src_set , "640.0w" )
240+ refute_includes ( src_set , "1280.0w" )
241+ end
242+
243+ def test_should_use_integer_descriptors_in_srcset_with_hash
244+ # Using plain hash with integer breakpoints
245+ result = @client . helper . get_responsive_image_attributes (
246+ {
247+ src : "sample.jpg" ,
248+ url_endpoint : "https://ik.imagekit.io/demo" ,
249+ device_breakpoints : [ 320 , 640 , 1280 ] ,
250+ image_breakpoints : [ ]
251+ }
252+ )
253+
254+ src_set = result . src_set
255+
256+ # Should have integer descriptors like "320w", NOT "320.0w"
257+ assert_includes ( src_set , "320w" )
258+ assert_includes ( src_set , "640w" )
259+ assert_includes ( src_set , "1280w" )
260+
261+ # Should NOT have float descriptors
262+ refute_includes ( src_set , "320.0w" )
263+ refute_includes ( src_set , "640.0w" )
264+ refute_includes ( src_set , "1280.0w" )
265+ end
266+
217267 def test_fallback_when_no_usable_vw_tokens
218268 result = @client . helper . get_responsive_image_attributes (
219269 src : "sample.jpg" ,
0 commit comments