@@ -350,14 +350,31 @@ describe('gridstack', function() {
350
350
expect ( parseInt ( el2 . getAttribute ( 'gs-w' ) ) ) . toBe ( 4 ) ;
351
351
expect ( parseInt ( el2 . getAttribute ( 'gs-h' ) ) ) . toBe ( 4 ) ;
352
352
353
- expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
354
- expect ( parseInt ( el3 . getAttribute ( 'gs-y' ) ) ) . toBe ( 6 ) ; // ??? keep same row, but might more intuitive higher
355
- expect ( parseInt ( el3 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ; // ??? could take entire width if it did above
353
+ // remembers autoPlacement so finds next slot on 12 layout after 4x2 + 4x4
354
+ expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 8 ) ;
355
+ expect ( parseInt ( el3 . getAttribute ( 'gs-y' ) ) ) . toBe ( 0 ) ;
356
+ expect ( parseInt ( el3 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ;
356
357
expect ( parseInt ( el3 . getAttribute ( 'gs-h' ) ) ) . toBe ( 1 ) ;
357
358
358
- // back to 1 column, move item2 to beginning to [3][1][2] vertically
359
+ // back to 1 column
359
360
grid . column ( 1 ) ;
360
361
expect ( grid . getColumn ( ) ) . toBe ( 1 ) ;
362
+ expect ( parseInt ( el1 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
363
+ expect ( parseInt ( el1 . getAttribute ( 'gs-y' ) ) ) . toBe ( 0 ) ;
364
+ expect ( parseInt ( el1 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ;
365
+ expect ( parseInt ( el1 . getAttribute ( 'gs-h' ) ) ) . toBe ( 2 ) ;
366
+
367
+ expect ( parseInt ( el2 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
368
+ expect ( parseInt ( el2 . getAttribute ( 'gs-y' ) ) ) . toBe ( 2 ) ;
369
+ expect ( parseInt ( el2 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ;
370
+ expect ( parseInt ( el2 . getAttribute ( 'gs-h' ) ) ) . toBe ( 4 ) ;
371
+
372
+ expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
373
+ expect ( parseInt ( el3 . getAttribute ( 'gs-y' ) ) ) . toBe ( 6 ) ;
374
+ expect ( parseInt ( el3 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ;
375
+ expect ( parseInt ( el3 . getAttribute ( 'gs-h' ) ) ) . toBe ( 1 ) ;
376
+
377
+ // move item2 to beginning to [3][1][2] vertically
361
378
grid . update ( el3 , { x :0 , y :0 } ) ;
362
379
expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
363
380
expect ( parseInt ( el3 . getAttribute ( 'gs-y' ) ) ) . toBe ( 0 ) ;
@@ -377,7 +394,7 @@ describe('gridstack', function() {
377
394
// back to 12 column, el3 to be beginning still, but [1][2] to be in 1 columns still but wide 4x2 and 4x still
378
395
grid . column ( 12 ) ;
379
396
expect ( grid . getColumn ( ) ) . toBe ( 12 ) ;
380
- expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
397
+ expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ; // 8 TEST WHY
381
398
expect ( parseInt ( el3 . getAttribute ( 'gs-y' ) ) ) . toBe ( 0 ) ;
382
399
expect ( parseInt ( el3 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ;
383
400
expect ( parseInt ( el3 . getAttribute ( 'gs-h' ) ) ) . toBe ( 1 ) ;
@@ -397,7 +414,7 @@ describe('gridstack', function() {
397
414
grid . column ( 2 ) ;
398
415
expect ( grid . getColumn ( ) ) . toBe ( 2 ) ;
399
416
400
- expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ;
417
+ expect ( parseInt ( el3 . getAttribute ( 'gs-x' ) ) ) . toBe ( 0 ) ; // 1 TEST WHY
401
418
expect ( parseInt ( el3 . getAttribute ( 'gs-y' ) ) ) . toBe ( 0 ) ;
402
419
expect ( parseInt ( el3 . getAttribute ( 'gs-w' ) ) ) . toBe ( 1 ) ; // 1 as we scaled from 12 columns
403
420
expect ( parseInt ( el3 . getAttribute ( 'gs-h' ) ) ) . toBe ( 1 ) ;
0 commit comments