1
1
import { async , TestBed , fakeAsync , tick } from '@angular/core/testing' ;
2
- import { By } from '@angular/platform-browser' ;
3
2
import { IgxGridModule } from './index' ;
4
- import {
5
- GridWithUndefinedDataComponent , PagingAndEditingComponent
6
- } from '../../test-utils/grid-samples.spec' ;
3
+ import { GridWithUndefinedDataComponent } from '../../test-utils/grid-samples.spec' ;
7
4
import { PagingComponent } from '../../test-utils/grid-base-components.spec' ;
8
5
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
9
6
@@ -12,7 +9,6 @@ import { wait } from '../../test-utils/ui-interactions.spec';
12
9
import { IgxNumberFilteringOperand } from '../../data-operations/filtering-condition' ;
13
10
import { GridFunctions , PAGER_CLASS } from '../../test-utils/grid-functions.spec' ;
14
11
import { ControlsFunction , BUTTON_DISABLED_CLASS } from '../../test-utils/controls-functions.spec' ;
15
- import { DebugElement } from '@angular/core' ;
16
12
17
13
function verifyGridPager ( fix , rowsCount , firstCellValue , pagerText , buttonsVisibility ) {
18
14
const grid = fix . componentInstance . grid ;
@@ -42,7 +38,6 @@ describe('IgxGrid - Grid Paging #grid', () => {
42
38
TestBed . configureTestingModule ( {
43
39
declarations : [
44
40
PagingComponent ,
45
- PagingAndEditingComponent ,
46
41
GridWithUndefinedDataComponent
47
42
] ,
48
43
imports : [ IgxGridModule , NoopAnimationsModule ]
@@ -60,11 +55,6 @@ describe('IgxGrid - Grid Paging #grid', () => {
60
55
grid = fix . componentInstance . grid ;
61
56
} ) ) ;
62
57
63
- afterAll ( fakeAsync ( ( ) => {
64
- fix = undefined ;
65
- grid = undefined ;
66
- } ) ) ;
67
-
68
58
it ( 'should paginate data UI' , ( ) => {
69
59
70
60
expect ( grid . paging ) . toBeTruthy ( ) ;
@@ -454,47 +444,6 @@ describe('IgxGrid - Grid Paging #grid', () => {
454
444
} ) ;
455
445
} ) ;
456
446
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
-
498
447
it ( 'should not throw error when data is undefined' , fakeAsync ( ( ) => {
499
448
500
449
let errorMessage = '' ;
0 commit comments