@@ -218,7 +218,7 @@ describe('Row Pinning #grid', () => {
218
218
expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
219
219
} ) ;
220
220
221
- it ( 'pinned rows and groupby.' , ( ) => {
221
+ fit ( 'pinned rows and groupby.' , ( ) => {
222
222
// pin 1st and 2nd data row
223
223
grid . pinRow ( fix . componentInstance . data [ 0 ] ) ;
224
224
grid . pinRow ( fix . componentInstance . data [ 1 ] ) ;
@@ -230,32 +230,24 @@ describe('Row Pinning #grid', () => {
230
230
} ) ;
231
231
fix . detectChanges ( ) ;
232
232
233
- expect ( grid . pinnedRecords . length ) . toBe ( 1 ) ;
234
- let pinRowContainer = fix . debugElement . queryAll ( By . css ( FIXED_ROW_CONTAINER ) ) ;
235
- expect ( pinRowContainer . length ) . toBe ( 1 ) ;
236
- expect ( pinRowContainer [ 0 ] . children . length ) . toBe ( 1 ) ;
237
- expect ( pinRowContainer [ 0 ] . children [ 0 ] . context . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
238
- expect ( pinRowContainer [ 0 ] . children [ 0 ] . nativeElement ) . toBe ( grid . getRowByIndex ( 0 ) . nativeElement ) ;
233
+ expect ( grid . pinnedRecords . length ) . toBe ( 2 ) ;
239
234
240
- expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
241
- expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ 2 ] ) ;
235
+ // verify rows
236
+ const groupRows = grid . groupsRowList . toArray ( ) ;
237
+ const dataRows = grid . dataRowList . toArray ( ) ;
242
238
243
- // pin 3rd data row
244
- grid . pinRow ( fix . componentInstance . data [ 2 ] ) ;
245
- fix . detectChanges ( ) ;
239
+ expect ( groupRows . length ) . toEqual ( 2 ) ;
240
+ expect ( dataRows . length ) . toEqual ( 7 ) ;
241
+ expect ( groupRows [ 0 ] . groupRow . records [ 0 ] . ID ) . toEqual ( 'AROUT' ) ;
246
242
247
- pinRowContainer = fix . debugElement . queryAll ( By . css ( FIXED_ROW_CONTAINER ) ) ;
248
- expect ( pinRowContainer [ 0 ] . children . length ) . toBe ( 2 ) ;
249
- expect ( pinRowContainer [ 0 ] . children [ 0 ] . context . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
250
- expect ( pinRowContainer [ 0 ] . children [ 1 ] . context . rowID ) . toBe ( fix . componentInstance . data [ 2 ] ) ;
243
+ // pin 4th data row with ID:AROUT
244
+ grid . pinRow ( fix . componentInstance . data [ 3 ] ) ;
245
+ fix . detectChanges ( ) ;
251
246
252
- expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
253
- expect ( grid . getRowByIndex ( 3 ) . rowID ) . toBe ( fix . componentInstance . data [ 3 ] ) ;
247
+ expect ( grid . pinnedRecords . length ) . toBe ( 3 ) ;
254
248
255
- // 2 records pinned + 2px border
256
- expect ( grid . pinnedRowHeight ) . toBe ( 2 * grid . renderedRowHeight + 2 ) ;
257
- const expectedHeight = parseInt ( grid . height , 10 ) - grid . pinnedRowHeight - 18 - grid . theadRow . nativeElement . offsetHeight ;
258
- expect ( grid . calcHeight - expectedHeight ) . toBeLessThanOrEqual ( 1 ) ;
249
+ // make sure the pinned row is out of the first groupBy group
250
+ expect ( groupRows [ 0 ] . groupRow . records [ 0 ] . ID ) . toEqual ( 'BLAUS' ) ;
259
251
} ) ;
260
252
} ) ;
261
253
} ) ;
0 commit comments