@@ -63,7 +63,7 @@ describe('IgxGrid - Grid Paging', () => {
6363 verifyGridPager ( fix , 3 , '1' , '1 of 4' , [ true , true , false , false ] ) ;
6464 } ) ) ;
6565
66- it ( 'should paginate data API' , ( ) => {
66+ it ( 'should paginate data API' , fakeAsync ( ( ) => {
6767 const fix = TestBed . createComponent ( PagingComponent ) ;
6868 fix . detectChanges ( ) ;
6969
@@ -72,31 +72,40 @@ describe('IgxGrid - Grid Paging', () => {
7272 grid . paging = true ;
7373 grid . perPage = 3 ;
7474 fix . detectChanges ( ) ;
75+ tick ( 16 ) ;
7576
7677 spyOn ( grid . onPagingDone , 'emit' ) ;
7778 grid . paginate ( 2 ) ;
7879
7980 fix . detectChanges ( ) ;
81+ tick ( 16 ) ;
82+
8083 expect ( grid . onPagingDone . emit ) . toHaveBeenCalled ( ) ;
8184 verifyGridPager ( fix , 3 , '7' , '3 of 4' , [ ] ) ;
8285
8386 // Go to next page
8487 grid . nextPage ( ) ;
8588 fix . detectChanges ( ) ;
89+ tick ( 16 ) ;
90+
8691 expect ( grid . onPagingDone . emit ) . toHaveBeenCalledTimes ( 2 ) ;
8792 expect ( grid . isLastPage ) . toBe ( true ) ;
8893 verifyGridPager ( fix , 1 , '10' , '4 of 4' , [ ] ) ;
8994
9095 // Go to next page when last page is selected
9196 grid . nextPage ( ) ;
9297 fix . detectChanges ( ) ;
98+ tick ( 16 ) ;
99+
93100 expect ( grid . isLastPage ) . toBe ( true ) ;
94101 expect ( grid . onPagingDone . emit ) . toHaveBeenCalledTimes ( 2 ) ;
95102 verifyGridPager ( fix , 1 , '10' , '4 of 4' , [ ] ) ;
96103
97104 // Go to previous page
98105 grid . previousPage ( ) ;
99106 fix . detectChanges ( ) ;
107+ tick ( 16 ) ;
108+
100109 expect ( grid . onPagingDone . emit ) . toHaveBeenCalledTimes ( 3 ) ;
101110 verifyGridPager ( fix , 3 , '7' , '3 of 4' , [ ] ) ;
102111 expect ( grid . isLastPage ) . toBe ( false ) ;
@@ -105,23 +114,29 @@ describe('IgxGrid - Grid Paging', () => {
105114 // Go to first page
106115 grid . paginate ( 0 ) ;
107116 fix . detectChanges ( ) ;
117+ tick ( 16 ) ;
118+
108119 expect ( grid . onPagingDone . emit ) . toHaveBeenCalledTimes ( 4 ) ;
109120 verifyGridPager ( fix , 3 , '1' , '1 of 4' , [ ] ) ;
110121 expect ( grid . isFirstPage ) . toBe ( true ) ;
111122
112123 // Go to previous page when first page is selected
113124 grid . previousPage ( ) ;
114125 fix . detectChanges ( ) ;
126+ tick ( 16 ) ;
127+
115128 expect ( grid . onPagingDone . emit ) . toHaveBeenCalledTimes ( 4 ) ;
116129 verifyGridPager ( fix , 3 , '1' , '1 of 4' , [ ] ) ;
117130 expect ( grid . isFirstPage ) . toBe ( true ) ;
118131
119132 // Go to negative page number
120133 grid . paginate ( - 3 ) ;
121134 fix . detectChanges ( ) ;
135+ tick ( 16 ) ;
136+
122137 expect ( grid . onPagingDone . emit ) . toHaveBeenCalledTimes ( 4 ) ;
123138 verifyGridPager ( fix , 3 , '1' , '1 of 4' , [ ] ) ;
124- } ) ;
139+ } ) ) ;
125140
126141 it ( 'change paging settings UI' , fakeAsync ( ( ) => {
127142 const fix = TestBed . createComponent ( PagingComponent ) ;
@@ -448,7 +463,7 @@ describe('IgxGrid - Grid Paging', () => {
448463 expect ( gridElement . querySelector ( PAGER_CLASS ) ) . not . toBeNull ( ) ;
449464 } ) ) ;
450465
451- it ( 'should display custom numbers in select from perPage' , ( ) => {
466+ it ( 'should display custom numbers in select from perPage' , fakeAsync ( ( ) => {
452467 const expectedOptions = [ 3 , 5 , 10 , 15 , 25 , 50 , 100 , 500 ] ;
453468 const defaultExpectedOptions = [ 5 , 10 , 15 , 25 , 50 , 100 , 500 ] ;
454469
@@ -469,9 +484,10 @@ describe('IgxGrid - Grid Paging', () => {
469484
470485 grid . perPage = 25 ;
471486 fix . detectChanges ( ) ;
487+ tick ( 16 ) ;
472488
473489 testOptions ( defaultExpectedOptions ) ;
474- } ) ;
490+ } ) ) ;
475491
476492 function verifyGridPager ( fix , rowsCount , firstCellValue , pagerText , buttonsVisibility ) {
477493 const disabled = 'igx-button--disabled' ;
0 commit comments