@@ -3,7 +3,7 @@ import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testin
33import { configureTestSuite } from '../../test-utils/configure-suite' ;
44import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
55import { 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' ;
77import { IgxGridModule } from './public_api' ;
88import { IgxGridComponent } from './grid.component' ;
99import { IgxGridRowComponent } from './grid-row.component' ;
@@ -42,7 +42,7 @@ describe('IgxGrid Master Detail #grid', () => {
4242 } ) ) ;
4343
4444 describe ( 'Basic' , ( ) => {
45- beforeEach ( fakeAsync ( ( ) => {
45+ beforeEach ( fakeAsync ( ( ) => {
4646 fix = TestBed . createComponent ( DefaultGridMasterDetailComponent ) ;
4747 fix . detectChanges ( ) ;
4848 grid = fix . componentInstance . grid ;
@@ -689,7 +689,7 @@ describe('IgxGrid Master Detail #grid', () => {
689689
690690 describe ( 'Integration' , ( ) => {
691691 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 ( ( ) => {
693693 fix = TestBed . createComponent ( DefaultGridMasterDetailComponent ) ;
694694 grid = fix . componentInstance . grid ;
695695 fix . detectChanges ( ) ;
@@ -859,6 +859,48 @@ describe('IgxGrid Master Detail #grid', () => {
859859 fix . detectChanges ( ) ;
860860 expect ( grid . getSelectedData ( ) ) . toEqual ( expectedData ) ;
861861 } ) ) ;
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+ } ) ) ;
862904 } ) ;
863905
864906 describe ( 'Row Selection' , ( ) => {
0 commit comments