@@ -29,6 +29,12 @@ describe('IgxGrid - Row Adding #grid', () => {
2929 let grid : IgxGridComponent ;
3030 let gridContent : DebugElement ;
3131 let actionStrip : IgxActionStripComponent ;
32+ const endTransition = ( ) => {
33+ // transition end needs to be simulated
34+ const animationElem = fixture . nativeElement . querySelector ( '.igx-grid__tr--inner' ) ;
35+ const endEvent = new AnimationEvent ( 'animationend' ) ;
36+ animationElem . dispatchEvent ( endEvent ) ;
37+ } ;
3238 configureTestSuite ( ) ;
3339 beforeAll ( async ( ( ) => {
3440 TestBed . configureTestingModule ( {
@@ -69,6 +75,9 @@ describe('IgxGrid - Row Adding #grid', () => {
6975 const rows = grid . rowList . toArray ( ) ;
7076 rows [ 0 ] . beginAddRow ( ) ;
7177 fixture . detectChanges ( ) ;
78+
79+ endTransition ( ) ;
80+
7281 let addRow = grid . getRowByIndex ( 1 ) ;
7382 expect ( addRow . addRow ) . toBeTrue ( ) ;
7483
@@ -97,6 +106,7 @@ describe('IgxGrid - Row Adding #grid', () => {
97106 addRowIcon . parent . triggerEventHandler ( 'click' , new Event ( 'click' ) ) ;
98107 fixture . detectChanges ( ) ;
99108
109+ endTransition ( ) ;
100110
101111 const addRow = grid . getRowByIndex ( lastRowIndex + 1 ) ;
102112 expect ( addRow . addRow ) . toBeTrue ( ) ;
@@ -159,6 +169,8 @@ describe('IgxGrid - Row Adding #grid', () => {
159169 row . beginAddRow ( ) ;
160170 fixture . detectChanges ( ) ;
161171
172+ endTransition ( ) ;
173+
162174 // add row should be pinned
163175 const addRow = grid . getRowByIndex ( 1 ) as IgxGridRowComponent ;
164176 expect ( addRow . addRow ) . toBe ( true ) ;
@@ -182,6 +194,8 @@ describe('IgxGrid - Row Adding #grid', () => {
182194 ghostRow . beginAddRow ( ) ;
183195 fixture . detectChanges ( ) ;
184196
197+ endTransition ( ) ;
198+
185199 // add row should be unpinned
186200 const addRow = grid . getRowByIndex ( 2 ) ;
187201 expect ( addRow . addRow ) . toBe ( true ) ;
@@ -199,6 +213,7 @@ describe('IgxGrid - Row Adding #grid', () => {
199213 const dataCount = grid . data . length ;
200214 rows [ 0 ] . beginAddRow ( ) ;
201215 fixture . detectChanges ( ) ;
216+ endTransition ( ) ;
202217
203218 grid . endEdit ( true ) ;
204219 fixture . detectChanges ( ) ;
@@ -233,6 +248,8 @@ describe('IgxGrid - Row Adding #grid', () => {
233248 rows [ 0 ] . beginAddRow ( ) ;
234249 fixture . detectChanges ( ) ;
235250
251+ endTransition ( ) ;
252+
236253 grid . endEdit ( true ) ;
237254 fixture . detectChanges ( ) ;
238255
@@ -346,6 +363,8 @@ describe('IgxGrid - Row Adding #grid', () => {
346363 grid . rowList . first . beginAddRow ( ) ;
347364 fixture . detectChanges ( ) ;
348365
366+ endTransition ( ) ;
367+
349368 const cell = grid . getCellByColumn ( 1 , 'CompanyName' ) ;
350369 const cellInput = cell . nativeElement . querySelector ( '[igxinput]' ) ;
351370 UIInteractions . setInputElementValue ( cellInput , 'aaa' ) ;
@@ -364,6 +383,8 @@ describe('IgxGrid - Row Adding #grid', () => {
364383 row . beginAddRow ( ) ;
365384 fixture . detectChanges ( ) ;
366385
386+ endTransition ( ) ;
387+
367388 const newRow = grid . getRowByIndex ( 1 ) ;
368389 expect ( newRow . addRow ) . toBeTrue ( ) ;
369390 expect ( grid . cellEditEnter . emit ) . toHaveBeenCalled ( ) ;
@@ -389,6 +410,7 @@ describe('IgxGrid - Row Adding #grid', () => {
389410
390411 grid . rowList . first . beginAddRow ( ) ;
391412 fixture . detectChanges ( ) ;
413+ endTransition ( ) ;
392414
393415 expect ( grid . getRowByIndex ( 1 ) . addRow ) . toBeFalse ( ) ;
394416 } ) ;
@@ -431,6 +453,8 @@ describe('IgxGrid - Row Adding #grid', () => {
431453 row . beginAddRow ( ) ;
432454 fixture . detectChanges ( ) ;
433455
456+ endTransition ( ) ;
457+
434458 let newRow = grid . getRowByIndex ( 1 ) ;
435459 expect ( newRow . addRow ) . toBeTrue ( ) ;
436460
@@ -449,6 +473,8 @@ describe('IgxGrid - Row Adding #grid', () => {
449473 row . beginAddRow ( ) ;
450474 fixture . detectChanges ( ) ;
451475
476+ endTransition ( ) ;
477+
452478 let newRow = grid . getRowByIndex ( 1 ) ;
453479 expect ( newRow . addRow ) . toBeTrue ( ) ;
454480
@@ -469,6 +495,8 @@ describe('IgxGrid - Row Adding #grid', () => {
469495 row . beginAddRow ( ) ;
470496 fixture . detectChanges ( ) ;
471497
498+ endTransition ( ) ;
499+
472500 let newRow = grid . getRowByIndex ( 1 ) ;
473501 expect ( newRow . addRow ) . toBeTrue ( ) ;
474502
@@ -486,6 +514,8 @@ describe('IgxGrid - Row Adding #grid', () => {
486514 row . beginAddRow ( ) ;
487515 fixture . detectChanges ( ) ;
488516
517+ endTransition ( ) ;
518+
489519 let newRow = grid . getRowByIndex ( 1 ) ;
490520 expect ( newRow . addRow ) . toBeTrue ( ) ;
491521
@@ -515,6 +545,7 @@ describe('IgxGrid - Row Adding #grid', () => {
515545 const row = grid . rowList . first ;
516546 row . beginAddRow ( ) ;
517547 fixture . detectChanges ( ) ;
548+ endTransition ( ) ;
518549
519550 GridFunctions . navigateToLastPage ( grid . nativeElement ) ;
520551 fixture . detectChanges ( ) ;
@@ -533,6 +564,8 @@ describe('IgxGrid - Row Adding #grid', () => {
533564 row . beginAddRow ( ) ;
534565 fixture . detectChanges ( ) ;
535566
567+ endTransition ( ) ;
568+
536569 const select = GridFunctions . getGridPageSelectElement ( fixture ) ;
537570 select . click ( ) ;
538571 fixture . detectChanges ( ) ;
@@ -560,6 +593,8 @@ describe('IgxGrid - Row Adding #grid', () => {
560593 row . beginAddRow ( ) ;
561594 fixture . detectChanges ( ) ;
562595
596+ endTransition ( ) ;
597+
563598 grid . filter ( 'CompanyName' , 'al' , IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) , true ) ;
564599 fixture . detectChanges ( ) ;
565600
@@ -576,6 +611,8 @@ describe('IgxGrid - Row Adding #grid', () => {
576611 row . beginAddRow ( ) ;
577612 fixture . detectChanges ( ) ;
578613
614+ endTransition ( ) ;
615+
579616 const newRow = grid . getRowByIndex ( 1 ) ;
580617 expect ( newRow . addRow ) . toBeTrue ( ) ;
581618
@@ -596,6 +633,7 @@ describe('IgxGrid - Row Adding #grid', () => {
596633 row . beginAddRow ( ) ;
597634 fixture . detectChanges ( ) ;
598635
636+ endTransition ( ) ;
599637 const newRow = grid . getRowByIndex ( 1 ) ;
600638 expect ( newRow . addRow ) . toBeTrue ( ) ;
601639
@@ -648,6 +686,8 @@ describe('IgxGrid - Row Adding #grid', () => {
648686 row . beginAddRow ( ) ;
649687 fixture . detectChanges ( ) ;
650688
689+ endTransition ( ) ;
690+
651691 const newRow = grid . getRowByIndex ( 1 ) ;
652692 expect ( newRow . addRow ) . toBeTrue ( ) ;
653693
@@ -732,6 +772,7 @@ describe('IgxGrid - Row Adding #grid', () => {
732772 let row = grid . getRowByIndex ( 1 ) ;
733773 row . beginAddRow ( ) ;
734774 fixture . detectChanges ( ) ;
775+ endTransition ( ) ;
735776
736777 const cell = grid . getCellByColumn ( 2 , 'CompanyName' ) ;
737778 const cellInput = cell . nativeElement . querySelector ( '[igxinput]' ) ;
@@ -769,6 +810,8 @@ describe('IgxGrid - Row Adding #grid', () => {
769810 grid . rowList . first . beginAddRow ( ) ;
770811 fixture . detectChanges ( ) ;
771812
813+ endTransition ( ) ;
814+
772815 grid . endEdit ( true ) ;
773816 fixture . detectChanges ( ) ;
774817
@@ -791,6 +834,9 @@ describe('IgxGrid - Row Adding #grid', () => {
791834 const row = grid . rowList . first ;
792835 row . beginAddRow ( ) ;
793836 fixture . detectChanges ( ) ;
837+
838+ endTransition ( ) ;
839+
794840 expect ( grid . getRowByIndex ( 1 ) . addRow ) . toBeTrue ( ) ;
795841 expect ( grid . rowEditingOverlay . collapsed ) . toEqual ( false ) ;
796842
@@ -808,6 +854,7 @@ describe('IgxGrid - Row Adding #grid', () => {
808854 const row = grid . rowList . first ;
809855 row . beginAddRow ( ) ;
810856 fixture . detectChanges ( ) ;
857+ endTransition ( ) ;
811858
812859 expect ( grid . getRowByIndex ( 1 ) . addRow ) . toBeTrue ( ) ;
813860 expect ( grid . rowEditingOverlay . collapsed ) . toEqual ( false ) ;
@@ -821,6 +868,7 @@ describe('IgxGrid - Row Adding #grid', () => {
821868
822869 row . beginAddRow ( ) ;
823870 fixture . detectChanges ( ) ;
871+ endTransition ( ) ;
824872 grid . unpinColumn ( 'CompanyName' ) ;
825873 fixture . detectChanges ( ) ;
826874
@@ -839,6 +887,8 @@ describe('IgxGrid - Row Adding #grid', () => {
839887 row . beginAddRow ( ) ;
840888 fixture . detectChanges ( ) ;
841889
890+ endTransition ( ) ;
891+
842892 expect ( grid . getRowByIndex ( 1 ) . addRow ) . toBeTrue ( ) ;
843893 expect ( grid . rowEditingOverlay . collapsed ) . toEqual ( false ) ;
844894
@@ -864,6 +914,9 @@ describe('IgxGrid - Row Adding #grid', () => {
864914 const row = grid . rowList . first ;
865915 row . beginAddRow ( ) ;
866916 fixture . detectChanges ( ) ;
917+
918+ endTransition ( ) ;
919+
867920 expect ( grid . getRowByIndex ( 1 ) . addRow ) . toBeTrue ( ) ;
868921 expect ( grid . rowEditingOverlay . collapsed ) . toEqual ( false ) ;
869922
@@ -889,6 +942,7 @@ describe('IgxGrid - Row Adding #grid', () => {
889942 const row = grid . rowList . first ;
890943 row . beginAddRow ( ) ;
891944 fixture . detectChanges ( ) ;
945+ endTransition ( ) ;
892946
893947 grid . endEdit ( true ) ;
894948 fixture . detectChanges ( ) ;
@@ -903,6 +957,8 @@ describe('IgxGrid - Row Adding #grid', () => {
903957 row . beginAddRow ( ) ;
904958 fixture . detectChanges ( ) ;
905959
960+ endTransition ( ) ;
961+
906962 grid . endEdit ( true ) ;
907963 fixture . detectChanges ( ) ;
908964 let states = grid . transactions . getAggregatedChanges ( true ) ;
0 commit comments