@@ -424,19 +424,19 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
424
424
fixture . detectChanges ( ) ;
425
425
grid = fixture . componentInstance . grid ;
426
426
} ) ) ;
427
+
427
428
it ( 'should resize columns with % width.' , fakeAsync ( ( ) => {
428
429
grid . height = null ;
429
430
fixture . detectChanges ( ) ;
430
431
const headers = GridFunctions . getColumnHeaders ( fixture ) ;
431
-
432
432
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
433
-
433
+
434
434
const headerResArea = headers [ 0 ] . parent . children [ 2 ] . nativeElement ;
435
435
const startPos = headerResArea . getBoundingClientRect ( ) . x ;
436
436
UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , startPos , 5 ) ;
437
437
tick ( 200 ) ;
438
438
fixture . detectChanges ( ) ;
439
-
439
+
440
440
const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
441
441
expect ( resizer ) . toBeDefined ( ) ;
442
442
// resize with 100px, which is 25%
@@ -445,65 +445,65 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
445
445
fixture . detectChanges ( ) ;
446
446
expect ( grid . columns [ 0 ] . width ) . toBe ( '50%' ) ;
447
447
} ) ) ;
448
-
448
+
449
449
it ( 'should resize columns with % width and % maxWidth.' , fakeAsync ( ( ) => {
450
450
grid . height = null ;
451
451
fixture . detectChanges ( ) ;
452
452
const headers = GridFunctions . getColumnHeaders ( fixture ) ;
453
453
grid . columns [ 0 ] . maxWidth = '30%' ;
454
454
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
455
-
455
+
456
456
const headerResArea = headers [ 0 ] . parent . children [ 2 ] . nativeElement ;
457
457
const startPos = headerResArea . getBoundingClientRect ( ) . x ;
458
458
UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , startPos , 5 ) ;
459
459
tick ( 200 ) ;
460
460
fixture . detectChanges ( ) ;
461
-
461
+
462
462
const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
463
463
expect ( resizer ) . toBeDefined ( ) ;
464
464
// resize with +100px, which is 25%
465
465
UIInteractions . simulateMouseEvent ( 'mousemove' , resizer , startPos + 100 , 5 ) ;
466
466
UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , startPos + 100 , 5 ) ;
467
467
fixture . detectChanges ( ) ;
468
-
468
+
469
469
expect ( grid . columns [ 0 ] . width ) . toBe ( grid . columns [ 0 ] . maxWidth ) ;
470
470
} ) ) ;
471
-
471
+
472
472
it ( 'should resize columns with % width and % minWidth.' , fakeAsync ( ( ) => {
473
473
grid . height = null ;
474
474
fixture . detectChanges ( ) ;
475
475
const headers = GridFunctions . getColumnHeaders ( fixture ) ;
476
476
grid . columns [ 0 ] . minWidth = '10%' ;
477
477
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
478
-
478
+
479
479
const headerResArea = headers [ 0 ] . parent . children [ 2 ] . nativeElement ;
480
480
const startPos = headerResArea . getBoundingClientRect ( ) . x ;
481
481
UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , startPos , 5 ) ;
482
482
tick ( 200 ) ;
483
483
fixture . detectChanges ( ) ;
484
-
484
+
485
485
const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
486
486
// resize with -100px
487
487
UIInteractions . simulateMouseEvent ( 'mousemove' , resizer , startPos - 100 , 5 ) ;
488
488
UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , startPos - 100 , 5 ) ;
489
489
fixture . detectChanges ( ) ;
490
-
490
+
491
491
expect ( grid . columns [ 0 ] . width ) . toBe ( grid . columns [ 0 ] . minWidth ) ;
492
492
} ) ) ;
493
-
493
+
494
494
it ( 'should resize columns with % width and pixel maxWidth.' , fakeAsync ( ( ) => {
495
495
grid . height = null ;
496
496
fixture . detectChanges ( ) ;
497
497
const headers = GridFunctions . getColumnHeaders ( fixture ) ;
498
498
grid . columns [ 0 ] . maxWidth = '200px' ;
499
499
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
500
-
500
+
501
501
const headerResArea = headers [ 0 ] . parent . children [ 2 ] . nativeElement ;
502
502
const startPos = headerResArea . getBoundingClientRect ( ) . x ;
503
503
UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , startPos , 5 ) ;
504
504
tick ( 200 ) ;
505
505
fixture . detectChanges ( ) ;
506
-
506
+
507
507
const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
508
508
expect ( resizer ) . toBeDefined ( ) ;
509
509
// resize with +200px, which is 50%
@@ -512,50 +512,40 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
512
512
fixture . detectChanges ( ) ;
513
513
expect ( grid . columns [ 0 ] . width ) . toBe ( '50%' ) ;
514
514
} ) ) ;
515
-
515
+
516
516
it ( 'should resize columns with % width and pixel minWidth.' , fakeAsync ( ( ) => {
517
-
518
- const fixture = TestBed . createComponent ( ColPercentageGridComponent ) ;
519
- fixture . detectChanges ( ) ;
520
- const grid = fixture . componentInstance . grid ;
521
517
grid . height = null ;
522
518
fixture . detectChanges ( ) ;
523
519
const headers = GridFunctions . getColumnHeaders ( fixture ) ;
524
520
// minWidth is 12.5% of the grid width - 400px
525
521
grid . columns [ 0 ] . minWidth = '50px' ;
526
522
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
527
-
523
+
528
524
const headerResArea = headers [ 0 ] . parent . children [ 2 ] . nativeElement ;
529
525
const startPos = headerResArea . getBoundingClientRect ( ) . x ;
530
526
UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , startPos , 5 ) ;
531
527
tick ( 200 ) ;
532
528
fixture . detectChanges ( ) ;
533
-
529
+
534
530
const resizer = GridFunctions . getResizer ( fixture ) . nativeElement ;
535
531
// resize with -100px
536
532
UIInteractions . simulateMouseEvent ( 'mousemove' , resizer , startPos - 100 , 5 ) ;
537
533
UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , startPos - 100 , 5 ) ;
538
534
fixture . detectChanges ( ) ;
539
-
535
+
540
536
expect ( grid . columns [ 0 ] . width ) . toBe ( '12.5%' ) ;
541
537
} ) ) ;
542
-
538
+
543
539
it ( 'should autosize column with % width programmatically.' , fakeAsync ( ( ) => {
544
- const fixture = TestBed . createComponent ( ColPercentageGridComponent ) ;
545
- fixture . detectChanges ( ) ;
546
- const grid = fixture . componentInstance . grid ;
547
540
grid . height = null ;
548
541
fixture . detectChanges ( ) ;
549
542
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
550
543
grid . columns [ 0 ] . autosize ( ) ;
551
544
fixture . detectChanges ( ) ;
552
545
expect ( grid . columns [ 0 ] . width ) . toBe ( '21%' ) ;
553
546
} ) ) ;
554
-
547
+
555
548
it ( 'should autosize column with % width on double click.' , fakeAsync ( ( ) => {
556
- const fixture = TestBed . createComponent ( ColPercentageGridComponent ) ;
557
- fixture . detectChanges ( ) ;
558
- const grid = fixture . componentInstance . grid ;
559
549
grid . height = null ;
560
550
fixture . detectChanges ( ) ;
561
551
expect ( grid . columns [ 0 ] . width ) . toBe ( '25%' ) ;
0 commit comments