@@ -383,11 +383,12 @@ describe('gridstack', function() {
383383 expect ( parseInt ( el2 . attr ( 'data-gs-height' ) ) ) . toBe ( 4 ) ;
384384
385385 expect ( parseInt ( el3 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
386- expect ( parseInt ( el3 . attr ( 'data-gs-y' ) ) ) . toBe ( 6 ) ;
386+ expect ( parseInt ( el3 . attr ( 'data-gs-y' ) ) ) . toBe ( 6 ) ; // ??? kept one column row 6 which is not ideal maybe.
387387 expect ( parseInt ( el3 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ; // ??? could take entire width if it did above
388388 expect ( parseInt ( el3 . attr ( 'data-gs-height' ) ) ) . toBe ( 1 ) ;
389389
390390 // back to 1 column, move item2 to beginning to [3][1][2] vertically
391+ // NOTE: MOVE will have NO EFFECT on other layouts (see #1127)
391392 grid . setColumn ( 1 ) ;
392393 expect ( grid . opts . column ) . toBe ( 1 ) ;
393394 grid . move ( el3 , 0 , 0 ) ;
@@ -406,44 +407,43 @@ describe('gridstack', function() {
406407 expect ( parseInt ( el2 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ;
407408 expect ( parseInt ( el2 . attr ( 'data-gs-height' ) ) ) . toBe ( 4 ) ;
408409
409- // back to 12 column, el3 to be beginning still, but [1][2] to be in 1 columns still but wide 4x2 and 4x still
410+ // back to 12 column, SAME as before 1 column change (move in 1 column don't effect others)
410411 grid . setColumn ( 12 ) ;
411412 expect ( grid . opts . column ) . toBe ( 12 ) ;
412-
413- expect ( parseInt ( el3 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
414- expect ( parseInt ( el3 . attr ( 'data-gs-y' ) ) ) . toBe ( 0 ) ;
415- expect ( parseInt ( el3 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ;
416- expect ( parseInt ( el3 . attr ( 'data-gs-height' ) ) ) . toBe ( 1 ) ;
417-
418413 expect ( parseInt ( el1 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
419- expect ( parseInt ( el1 . attr ( 'data-gs-y' ) ) ) . toBe ( 1 ) ;
414+ expect ( parseInt ( el1 . attr ( 'data-gs-y' ) ) ) . toBe ( 0 ) ;
420415 expect ( parseInt ( el1 . attr ( 'data-gs-width' ) ) ) . toBe ( 4 ) ;
421416 expect ( parseInt ( el1 . attr ( 'data-gs-height' ) ) ) . toBe ( 2 ) ;
422417
423- expect ( parseInt ( el2 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
424- expect ( parseInt ( el2 . attr ( 'data-gs-y' ) ) ) . toBe ( 3 ) ;
418+ expect ( parseInt ( el2 . attr ( 'data-gs-x' ) ) ) . toBe ( 4 ) ;
419+ expect ( parseInt ( el2 . attr ( 'data-gs-y' ) ) ) . toBe ( 0 ) ;
425420 expect ( parseInt ( el2 . attr ( 'data-gs-width' ) ) ) . toBe ( 4 ) ;
426421 expect ( parseInt ( el2 . attr ( 'data-gs-height' ) ) ) . toBe ( 4 ) ;
427422
428- // 2 column will have item1, item2, item3 in 1 column still but half the width
423+ expect ( parseInt ( el3 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
424+ expect ( parseInt ( el3 . attr ( 'data-gs-y' ) ) ) . toBe ( 6 ) ;
425+ expect ( parseInt ( el3 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ; // ??? could take entire width if it did above
426+ expect ( parseInt ( el3 . attr ( 'data-gs-height' ) ) ) . toBe ( 1 ) ;
427+
428+ // 2 column will generate from scaled down 12
429429 grid . setColumn ( 1 ) ; // test convert from small, should use 12 layout still
430430 grid . setColumn ( 2 ) ;
431431 expect ( grid . opts . column ) . toBe ( 2 ) ;
432432
433- expect ( parseInt ( el3 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
434- expect ( parseInt ( el3 . attr ( 'data-gs-y' ) ) ) . toBe ( 0 ) ;
435- expect ( parseInt ( el3 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ; // 1 as we scaled from 12 columns
436- expect ( parseInt ( el3 . attr ( 'data-gs-height' ) ) ) . toBe ( 1 ) ;
437-
438433 expect ( parseInt ( el1 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
439- expect ( parseInt ( el1 . attr ( 'data-gs-y' ) ) ) . toBe ( 1 ) ;
434+ expect ( parseInt ( el1 . attr ( 'data-gs-y' ) ) ) . toBe ( 0 ) ;
440435 expect ( parseInt ( el1 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ;
441436 expect ( parseInt ( el1 . attr ( 'data-gs-height' ) ) ) . toBe ( 2 ) ;
442437
443- expect ( parseInt ( el2 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
444- expect ( parseInt ( el2 . attr ( 'data-gs-y' ) ) ) . toBe ( 3 ) ;
438+ expect ( parseInt ( el2 . attr ( 'data-gs-x' ) ) ) . toBe ( 1 ) ;
439+ expect ( parseInt ( el2 . attr ( 'data-gs-y' ) ) ) . toBe ( 0 ) ;
445440 expect ( parseInt ( el2 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ;
446441 expect ( parseInt ( el2 . attr ( 'data-gs-height' ) ) ) . toBe ( 4 ) ;
442+
443+ expect ( parseInt ( el3 . attr ( 'data-gs-x' ) ) ) . toBe ( 0 ) ;
444+ expect ( parseInt ( el3 . attr ( 'data-gs-y' ) ) ) . toBe ( 6 ) ;
445+ expect ( parseInt ( el3 . attr ( 'data-gs-width' ) ) ) . toBe ( 1 ) ;
446+ expect ( parseInt ( el3 . attr ( 'data-gs-height' ) ) ) . toBe ( 1 ) ;
447447 } ) ;
448448 } ) ;
449449
0 commit comments