@@ -207,4 +207,53 @@ describe('regression >', () => {
207207 expect ( sg . el . style . minHeight ) . toBe ( '100px' ) ; // grew to fit both rows
208208 } ) ;
209209 } ) ;
210+
211+ describe ( '3000 float: pushed items restore when dragging back >' , ( ) => {
212+ beforeEach ( ( ) => {
213+ document . body . insertAdjacentHTML ( 'afterbegin' , gridstackEmptyHTML ) ;
214+ } ) ;
215+ afterEach ( ( ) => {
216+ document . body . removeChild ( document . getElementById ( 'gs-cont' ) ) ;
217+ } ) ;
218+
219+ // NOTE: this no longer reproduced when re-checked on 2026-09-14 (the mode:'float' rework in
220+ // 61e358bf landed after the report), so this locks the reported behavior in rather than fixing it.
221+ it ( 'two h=2 items, pushed 3 rows down, both come back' , ( ) => {
222+ grid = GridStack . init ( { mode : 'float' , cellHeight : 50 , children : [
223+ { id : 'A' , x : 0 , y : 0 , w : 2 , h : 2 } ,
224+ { id : 'B' , x : 0 , y : 2 , w : 2 , h : 2 } ,
225+ ] } ) ;
226+ const A = grid . engine . nodes . find ( n => n . id === 'A' ) ! ;
227+ const B = grid . engine . nodes . find ( n => n . id === 'B' ) ! ;
228+
229+ grid . engine . cleanNodes ( ) . beginUpdate ( A ) ; // dragstart snapshots _orig for everyone
230+ expect ( B . _orig ! . y ) . toBe ( 2 ) ;
231+
232+ [ 1 , 2 , 3 ] . forEach ( y => grid . engine . moveNode ( A , { x : 0 , y, w : 2 , h : 2 } ) ) ;
233+ expect ( A . y ) . toBe ( 3 ) ;
234+ expect ( B . y ) . toBe ( 5 ) ; // pushed the reported 3 rows
235+
236+ [ 2 , 1 , 0 ] . forEach ( y => grid . engine . moveNode ( A , { x : 0 , y, w : 2 , h : 2 } ) ) ;
237+ expect ( A . y ) . toBe ( 0 ) ;
238+ expect ( B . y ) . toBe ( 2 ) ; // ...and restored, rather than stranded at 5
239+ grid . engine . endUpdate ( ) ;
240+ } ) ;
241+
242+ it ( 'a third item blocking the way only holds items back as far as it must' , ( ) => {
243+ grid = GridStack . init ( { mode : 'float' , cellHeight : 50 , children : [
244+ { id : 'A' , x : 0 , y : 0 , w : 2 , h : 2 } ,
245+ { id : 'B' , x : 0 , y : 2 , w : 2 , h : 2 } ,
246+ { id : 'C' , x : 4 , y : 0 , w : 2 , h : 2 } ,
247+ ] } ) ;
248+ const [ A , B , C ] = [ 'A' , 'B' , 'C' ] . map ( id => grid . engine . nodes . find ( n => n . id === id ) ! ) ;
249+ grid . engine . cleanNodes ( ) . beginUpdate ( A ) ;
250+
251+ [ 1 , 2 , 3 ] . forEach ( y => grid . engine . moveNode ( A , { x : 0 , y, w : 2 , h : 2 } ) ) ;
252+ expect ( B . y ) . toBe ( 5 ) ;
253+ [ 2 , 1 , 0 ] . forEach ( y => grid . engine . moveNode ( A , { x : 0 , y, w : 2 , h : 2 } ) ) ;
254+ expect ( B . y ) . toBe ( 2 ) ;
255+ expect ( C . y ) . toBe ( 0 ) ; // untouched in its own column
256+ grid . engine . endUpdate ( ) ;
257+ } ) ;
258+ } ) ;
210259} ) ;
0 commit comments