@@ -3,7 +3,7 @@ import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testin
3
3
import { configureTestSuite } from '../../test-utils/configure-suite' ;
4
4
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
5
5
import { By } from '@angular/platform-browser' ;
6
- import { UIInteractions , wait , waitForActiveNodeChange } from '../../test-utils/ui-interactions.spec' ;
6
+ import { UIInteractions , wait , waitForActiveNodeChange } from '../../test-utils/ui-interactions.spec' ;
7
7
import { IgxGridModule } from './public_api' ;
8
8
import { IgxGridComponent } from './grid.component' ;
9
9
import { IgxGridRowComponent } from './grid-row.component' ;
@@ -42,7 +42,7 @@ describe('IgxGrid Master Detail #grid', () => {
42
42
} ) ) ;
43
43
44
44
describe ( 'Basic' , ( ) => {
45
- beforeEach ( fakeAsync ( ( ) => {
45
+ beforeEach ( fakeAsync ( ( ) => {
46
46
fix = TestBed . createComponent ( DefaultGridMasterDetailComponent ) ;
47
47
fix . detectChanges ( ) ;
48
48
grid = fix . componentInstance . grid ;
@@ -689,7 +689,7 @@ describe('IgxGrid Master Detail #grid', () => {
689
689
690
690
describe ( 'Integration' , ( ) => {
691
691
describe ( 'Paging' , ( ) => {
692
- it ( 'Should not take into account expanded detail views as additional records.' , fakeAsync ( ( ) => {
692
+ it ( 'Should not take into account expanded detail views as additional records.' , fakeAsync ( ( ) => {
693
693
fix = TestBed . createComponent ( DefaultGridMasterDetailComponent ) ;
694
694
grid = fix . componentInstance . grid ;
695
695
fix . detectChanges ( ) ;
@@ -859,6 +859,48 @@ describe('IgxGrid Master Detail #grid', () => {
859
859
fix . detectChanges ( ) ;
860
860
expect ( grid . getSelectedData ( ) ) . toEqual ( expectedData ) ;
861
861
} ) ) ;
862
+
863
+ it ( 'getSelectedData should return correct values when there are master details and paging is enabled' , fakeAsync ( ( ) => {
864
+ const range = { rowStart : 0 , rowEnd : 5 , columnStart : 'ContactName' , columnEnd : 'ContactName' } ;
865
+ const expectedDataFromSecondPage = [
866
+ { ContactName : 'Hanna Moos' } ,
867
+ { ContactName : 'Frédérique Citeaux' } ,
868
+ { ContactName : 'Martín Sommer' }
869
+ ] ;
870
+ fix . componentInstance . paging = true ;
871
+ fix . detectChanges ( ) ;
872
+ grid . paginator . perPage = 5 ;
873
+ fix . detectChanges ( ) ;
874
+ tick ( 16 ) ;
875
+ grid . paginator . paginate ( 1 ) ;
876
+ fix . detectChanges ( ) ;
877
+ tick ( 16 ) ;
878
+
879
+ grid . expandAll ( ) ;
880
+ tick ( 100 ) ;
881
+ fix . detectChanges ( ) ;
882
+
883
+ grid . selectRange ( range ) ;
884
+ fix . detectChanges ( ) ;
885
+ expect ( grid . getSelectedData ( ) ) . toEqual ( expectedDataFromSecondPage ) ;
886
+
887
+ const expectedDataFromThirdPage = [
888
+ { ContactName : 'Victoria Ashworth' } ,
889
+ { ContactName : 'Patricio Simpson' } ,
890
+ { ContactName : 'Francisco Chang' }
891
+ ] ;
892
+ grid . paginator . paginate ( 2 ) ;
893
+ fix . detectChanges ( ) ;
894
+ tick ( 16 ) ;
895
+
896
+ grid . expandAll ( ) ;
897
+ tick ( 100 ) ;
898
+ fix . detectChanges ( ) ;
899
+
900
+ grid . selectRange ( range ) ;
901
+ fix . detectChanges ( ) ;
902
+ expect ( grid . getSelectedData ( ) ) . toEqual ( expectedDataFromThirdPage ) ;
903
+ } ) ) ;
862
904
} ) ;
863
905
864
906
describe ( 'Row Selection' , ( ) => {
0 commit comments