Skip to content

Commit a407e16

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Add test with more complex layout to unmerge on activation.
1 parent 133a430 commit a407e16

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed

projects/igniteui-angular/src/lib/grids/grid/cell-merge.spec.ts

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,206 @@ describe('IgxGrid - Cell merging #grid', () => {
464464
]);
465465
});
466466

467+
it('should interrupt merge sequence correctly when there are multiple overlapping merge groups affected.', async () => {
468+
const col1 = grid.getColumnByName('ProductName');
469+
const col2 = grid.getColumnByName('Downloads');
470+
const col3 = grid.getColumnByName('Released');
471+
const col4 = grid.getColumnByName('ReleaseDate');
472+
473+
col1.merge = true;
474+
col2.merge = true;
475+
col3.merge = true;
476+
col4.merge = true;
477+
478+
fix.detectChanges();
479+
480+
const data = [
481+
{
482+
Downloads: 1000,
483+
ID: 1,
484+
ProductName: 'Ignite UI for JavaScript',
485+
ReleaseDate: fix.componentInstance.today,
486+
Released: true
487+
},
488+
{
489+
Downloads: 1000,
490+
ID: 2,
491+
ProductName: 'Ignite UI for JavaScript',
492+
ReleaseDate: fix.componentInstance.today,
493+
Released: true
494+
},
495+
{
496+
Downloads: 1000,
497+
ID: 3,
498+
ProductName: 'Ignite UI for Angular',
499+
ReleaseDate: fix.componentInstance.today,
500+
Released: true
501+
},
502+
{
503+
Downloads: 1000,
504+
ID: 4,
505+
ProductName: 'Ignite UI for JavaScript',
506+
ReleaseDate: fix.componentInstance.prevDay,
507+
Released: true
508+
},
509+
{
510+
Downloads: 100,
511+
ID: 5,
512+
ProductName: 'Ignite UI for Angular',
513+
ReleaseDate: fix.componentInstance.prevDay,
514+
Released: true
515+
},
516+
{
517+
Downloads: 1000,
518+
ID: 6,
519+
ProductName: 'Ignite UI for Angular',
520+
ReleaseDate: null,
521+
Released: true
522+
},
523+
{
524+
Downloads: 0,
525+
ID: 7,
526+
ProductName: null,
527+
ReleaseDate: fix.componentInstance.prevDay,
528+
Released: true
529+
},
530+
{
531+
Downloads: 1000,
532+
ID: 8,
533+
ProductName: 'NetAdvantage',
534+
ReleaseDate: fix.componentInstance.prevDay,
535+
Released: true
536+
},
537+
{
538+
Downloads: 1000,
539+
ID: 9,
540+
ProductName: 'NetAdvantage',
541+
ReleaseDate: null,
542+
Released: true
543+
}
544+
];
545+
fix.componentInstance.data = data;
546+
fix.detectChanges();
547+
548+
const row1 = grid.rowList.toArray()[0];
549+
UIInteractions.simulateClickAndSelectEvent(row1.cells.toArray()[1].nativeElement);
550+
await wait(1);
551+
fix.detectChanges();
552+
553+
GridFunctions.verifyColumnMergedState(grid, col1, [
554+
{ value: 'Ignite UI for JavaScript', span: 1 },
555+
{ value: 'Ignite UI for JavaScript', span: 1 },
556+
{ value: 'Ignite UI for Angular', span: 1 },
557+
{ value: 'Ignite UI for JavaScript', span: 1 },
558+
{ value: 'Ignite UI for Angular', span: 2 },
559+
{ value: null, span: 1 },
560+
{ value: 'NetAdvantage', span: 2 }
561+
]);
562+
563+
GridFunctions.verifyColumnMergedState(grid, col2, [
564+
{ value: 1000, span: 1 },
565+
{ value: 1000, span: 3 },
566+
{ value: 100, span: 1 },
567+
{ value: 1000, span: 1 },
568+
{ value: 0, span: 1 },
569+
{ value: 1000, span: 2 }
570+
]);
571+
572+
GridFunctions.verifyColumnMergedState(grid, col3, [
573+
{ value: true, span: 1 },
574+
{ value: true, span: 8 }
575+
]);
576+
577+
GridFunctions.verifyColumnMergedState(grid, col4, [
578+
{ value: fix.componentInstance.today, span: 1 },
579+
{ value: fix.componentInstance.today, span: 2 },
580+
{ value: fix.componentInstance.prevDay, span: 2 },
581+
{ value: null, span: 1 },
582+
{ value: fix.componentInstance.prevDay, span: 2 },
583+
{ value: null, span: 1 }
584+
]);
585+
586+
const row2 = grid.rowList.toArray()[1];
587+
UIInteractions.simulateClickAndSelectEvent(row2.cells.toArray()[1].nativeElement);
588+
await wait(1);
589+
fix.detectChanges();
590+
591+
GridFunctions.verifyColumnMergedState(grid, col1, [
592+
{ value: 'Ignite UI for JavaScript', span: 1 },
593+
{ value: 'Ignite UI for JavaScript', span: 1 },
594+
{ value: 'Ignite UI for Angular', span: 1 },
595+
{ value: 'Ignite UI for JavaScript', span: 1 },
596+
{ value: 'Ignite UI for Angular', span: 2 },
597+
{ value: null, span: 1 },
598+
{ value: 'NetAdvantage', span: 2 }
599+
]);
600+
601+
GridFunctions.verifyColumnMergedState(grid, col2, [
602+
{ value: 1000, span: 1 },
603+
{ value: 1000, span: 1 },
604+
{ value: 1000, span: 2 },
605+
{ value: 100, span: 1 },
606+
{ value: 1000, span: 1 },
607+
{ value: 0, span: 1 },
608+
{ value: 1000, span: 2 }
609+
]);
610+
611+
GridFunctions.verifyColumnMergedState(grid, col3, [
612+
{ value: true, span: 1 },
613+
{ value: true, span: 1 },
614+
{ value: true, span: 7 }
615+
]);
616+
617+
GridFunctions.verifyColumnMergedState(grid, col4, [
618+
{ value: fix.componentInstance.today, span: 1 },
619+
{ value: fix.componentInstance.today, span: 1 },
620+
{ value: fix.componentInstance.today, span: 1 },
621+
{ value: fix.componentInstance.prevDay, span: 2 },
622+
{ value: null, span: 1 },
623+
{ value: fix.componentInstance.prevDay, span: 2 },
624+
{ value: null, span: 1 }
625+
]);
626+
627+
const row3 = grid.rowList.toArray()[2];
628+
UIInteractions.simulateClickAndSelectEvent(row3.cells.toArray()[1].nativeElement);
629+
await wait(1);
630+
fix.detectChanges();
631+
632+
GridFunctions.verifyColumnMergedState(grid, col1, [
633+
{ value: 'Ignite UI for JavaScript', span: 2 },
634+
{ value: 'Ignite UI for Angular', span: 1 },
635+
{ value: 'Ignite UI for JavaScript', span: 1 },
636+
{ value: 'Ignite UI for Angular', span: 2 },
637+
{ value: null, span: 1 },
638+
{ value: 'NetAdvantage', span: 2 }
639+
]);
640+
641+
GridFunctions.verifyColumnMergedState(grid, col2, [
642+
{ value: 1000, span: 2 },
643+
{ value: 1000, span: 1 },
644+
{ value: 1000, span: 1 },
645+
{ value: 100, span: 1 },
646+
{ value: 1000, span: 1 },
647+
{ value: 0, span: 1 },
648+
{ value: 1000, span: 2 }
649+
]);
650+
651+
GridFunctions.verifyColumnMergedState(grid, col3, [
652+
{ value: true, span: 2 },
653+
{ value: true, span: 1 },
654+
{ value: true, span: 6 }
655+
]);
656+
657+
GridFunctions.verifyColumnMergedState(grid, col4, [
658+
{ value: fix.componentInstance.today, span: 2 },
659+
{ value: fix.componentInstance.today, span: 1 },
660+
{ value: fix.componentInstance.prevDay, span: 2 },
661+
{ value: null, span: 1 },
662+
{ value: fix.componentInstance.prevDay, span: 2 },
663+
{ value: null, span: 1 }
664+
]);
665+
});
666+
467667
});
468668

469669
describe('Updating', () => {

0 commit comments

Comments
 (0)