Skip to content

Commit 3b04280

Browse files
committed
test partial fix
* fix #2232 test cases update for first issues (now correct) but second parts doesn't seem right... need to spend time debugging this later
1 parent 624968d commit 3b04280

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

spec/gridstack-spec.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,31 @@ describe('gridstack', function() {
350350
expect(parseInt(el2.getAttribute('gs-w'))).toBe(4);
351351
expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);
352352

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);
356357
expect(parseInt(el3.getAttribute('gs-h'))).toBe(1);
357358

358-
// back to 1 column, move item2 to beginning to [3][1][2] vertically
359+
// back to 1 column
359360
grid.column(1);
360361
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
361378
grid.update(el3, {x:0, y:0});
362379
expect(parseInt(el3.getAttribute('gs-x'))).toBe(0);
363380
expect(parseInt(el3.getAttribute('gs-y'))).toBe(0);
@@ -377,7 +394,7 @@ describe('gridstack', function() {
377394
// back to 12 column, el3 to be beginning still, but [1][2] to be in 1 columns still but wide 4x2 and 4x still
378395
grid.column(12);
379396
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
381398
expect(parseInt(el3.getAttribute('gs-y'))).toBe(0);
382399
expect(parseInt(el3.getAttribute('gs-w'))).toBe(1);
383400
expect(parseInt(el3.getAttribute('gs-h'))).toBe(1);
@@ -397,7 +414,7 @@ describe('gridstack', function() {
397414
grid.column(2);
398415
expect(grid.getColumn()).toBe(2);
399416

400-
expect(parseInt(el3.getAttribute('gs-x'))).toBe(0);
417+
expect(parseInt(el3.getAttribute('gs-x'))).toBe(0); // 1 TEST WHY
401418
expect(parseInt(el3.getAttribute('gs-y'))).toBe(0);
402419
expect(parseInt(el3.getAttribute('gs-w'))).toBe(1); // 1 as we scaled from 12 columns
403420
expect(parseInt(el3.getAttribute('gs-h'))).toBe(1);

0 commit comments

Comments
 (0)