11import { async , TestBed , fakeAsync , tick } from '@angular/core/testing' ;
2- import { By } from '@angular/platform-browser' ;
32import { IgxGridModule } from './index' ;
4- import {
5- GridWithUndefinedDataComponent , PagingAndEditingComponent
6- } from '../../test-utils/grid-samples.spec' ;
3+ import { GridWithUndefinedDataComponent } from '../../test-utils/grid-samples.spec' ;
74import { PagingComponent } from '../../test-utils/grid-base-components.spec' ;
85import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
96
@@ -12,7 +9,6 @@ import { wait } from '../../test-utils/ui-interactions.spec';
129import { IgxNumberFilteringOperand } from '../../data-operations/filtering-condition' ;
1310import { GridFunctions , PAGER_CLASS } from '../../test-utils/grid-functions.spec' ;
1411import { ControlsFunction , BUTTON_DISABLED_CLASS } from '../../test-utils/controls-functions.spec' ;
15- import { DebugElement } from '@angular/core' ;
1612
1713function verifyGridPager ( fix , rowsCount , firstCellValue , pagerText , buttonsVisibility ) {
1814 const grid = fix . componentInstance . grid ;
@@ -42,7 +38,6 @@ describe('IgxGrid - Grid Paging #grid', () => {
4238 TestBed . configureTestingModule ( {
4339 declarations : [
4440 PagingComponent ,
45- PagingAndEditingComponent ,
4641 GridWithUndefinedDataComponent
4742 ] ,
4843 imports : [ IgxGridModule , NoopAnimationsModule ]
@@ -60,11 +55,6 @@ describe('IgxGrid - Grid Paging #grid', () => {
6055 grid = fix . componentInstance . grid ;
6156 } ) ) ;
6257
63- afterAll ( fakeAsync ( ( ) => {
64- fix = undefined ;
65- grid = undefined ;
66- } ) ) ;
67-
6858 it ( 'should paginate data UI' , ( ) => {
6959
7060 expect ( grid . paging ) . toBeTruthy ( ) ;
@@ -454,47 +444,6 @@ describe('IgxGrid - Grid Paging #grid', () => {
454444 } ) ;
455445 } ) ;
456446
457- it ( 'change paging with button' , ( ) => {
458-
459- fix = TestBed . createComponent ( PagingAndEditingComponent ) ;
460- fix . detectChanges ( ) ;
461- grid = fix . componentInstance . grid ;
462-
463- const nextBtn : DebugElement = fix . debugElement . query ( By . css ( '#nextPageBtn' ) ) ;
464- const prevBtn : DebugElement = fix . debugElement . query ( By . css ( '#prevPageBtn' ) ) ;
465- const idxPageBtn : DebugElement = fix . debugElement . query ( By . css ( '#idxPageBtn' ) ) ;
466-
467- expect ( nextBtn . nativeElement ) . toBeTruthy ( ) ;
468- expect ( nextBtn . nativeElement ) . toBeTruthy ( ) ;
469- expect ( nextBtn . nativeElement ) . toBeTruthy ( ) ;
470-
471- expect ( grid . paging ) . toBeTruthy ( ) ;
472- expect ( grid . page ) . toEqual ( 0 ) ;
473- expect ( grid . perPage ) . toMatch ( '4' , 'Invalid page size' ) ;
474- verifyGridPager ( fix , 4 , '1' , '1\xA0of\xA03' , [ ] ) ;
475-
476- // Next page button click
477- GridFunctions . clickOnPaginatorButton ( nextBtn ) ;
478- fix . detectChanges ( ) ;
479-
480- expect ( grid . page ) . toEqual ( 1 , 'Invalid page index' ) ;
481- verifyGridPager ( fix , 4 , '5' , '2\xA0of\xA03' , [ ] ) ;
482-
483- // Previous page button click
484- GridFunctions . clickOnPaginatorButton ( prevBtn ) ;
485- fix . detectChanges ( ) ;
486-
487- expect ( grid . page ) . toEqual ( 0 , 'Invalid page index' ) ;
488- verifyGridPager ( fix , 4 , '1' , '1\xA0of\xA03' , [ ] ) ;
489-
490- // Go to 3rd page button click
491- GridFunctions . clickOnPaginatorButton ( idxPageBtn ) ;
492- fix . detectChanges ( ) ;
493-
494- expect ( grid . page ) . toEqual ( 2 , 'Invalid page index' ) ;
495- verifyGridPager ( fix , 2 , '9' , '3\xA0of\xA03' , [ ] ) ;
496- } ) ;
497-
498447 it ( 'should not throw error when data is undefined' , fakeAsync ( ( ) => {
499448
500449 let errorMessage = '' ;
0 commit comments